rust: use 'impl Trait' in method argument of AncestorsIterator
authorYuya Nishihara <yuya@tcha.org>
Tue, 18 Dec 2018 22:23:48 +0900
changeset 41105 35ee590b1892
parent 41104 247f51cfc668
child 41106 dc56a6273575
rust: use 'impl Trait' in method argument of AncestorsIterator I just didn't know it's stabilized. Let's switch to new convenient syntax. Differential Revision: https://phab.mercurial-scm.org/D5451
rust/hg-core/src/ancestors.rs
--- a/rust/hg-core/src/ancestors.rs	Tue Dec 18 22:12:16 2018 +0900
+++ b/rust/hg-core/src/ancestors.rs	Tue Dec 18 22:23:48 2018 +0900
@@ -44,15 +44,12 @@
     ///
     /// if `inclusive` is true, then the init revisions are emitted in
     /// particular, otherwise iteration starts from their parents.
-    pub fn new<I>(
+    pub fn new(
         graph: G,
-        initrevs: I,
+        initrevs: impl IntoIterator<Item = Revision>,
         stoprev: Revision,
         inclusive: bool,
-    ) -> Result<Self, GraphError>
-    where
-        I: IntoIterator<Item = Revision>,
-    {
+    ) -> Result<Self, GraphError> {
         let filtered_initrevs = initrevs.into_iter().filter(|&r| r >= stoprev);
         if inclusive {
             let visit: BinaryHeap<Revision> = filtered_initrevs.collect();