about summary refs log tree commit diff
path: root/clippy_dev/src
diff options
context:
space:
mode:
authorOliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer <github35764891676564198441@oli-obk.de>2018-10-11 09:20:20 +0200
committerGitHub <noreply@github.com>2018-10-11 09:20:20 +0200
commit5e38944ebe73b901934fc81ad4fe4f443988f8b3 (patch)
tree5fd525da3270d0b87d2a84c09d1925c3bd7817d1 /clippy_dev/src
parent928a6d3dc7321126f95a876a87391ca48aff8045 (diff)
parent759ceb984039dee7cac226c656cf599712b5e038 (diff)
downloadrust-5e38944ebe73b901934fc81ad4fe4f443988f8b3.tar.gz
rust-5e38944ebe73b901934fc81ad4fe4f443988f8b3.zip
Merge pull request #3295 from phansch/refactor_clippy_dev
Use `impl Iterator` in arg position in clippy_dev
Diffstat (limited to 'clippy_dev/src')
-rw-r--r--clippy_dev/src/lib.rs6
-rw-r--r--clippy_dev/src/main.rs2
2 files changed, 4 insertions, 4 deletions
diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs
index 2087a4b0740..0e29db9bef0 100644
--- a/clippy_dev/src/lib.rs
+++ b/clippy_dev/src/lib.rs
@@ -56,8 +56,8 @@ impl Lint {
     }
 
     /// Returns all non-deprecated lints
-    pub fn active_lints(lints: &[Self]) -> impl Iterator<Item=&Self> {
-        lints.iter().filter(|l| l.deprecation.is_none())
+    pub fn active_lints(lints: impl Iterator<Item=Self>) -> impl Iterator<Item=Self> {
+        lints.filter(|l| l.deprecation.is_none())
     }
 
     /// Returns the lints in a HashMap, grouped by the different lint groups
@@ -144,7 +144,7 @@ fn test_active_lints() {
     let expected = vec![
         Lint::new("should_assert_eq2", "Not Deprecated", "abc", None, "module_name")
     ];
-    assert_eq!(expected, Lint::active_lints(&lints).cloned().collect::<Vec<Lint>>());
+    assert_eq!(expected, Lint::active_lints(lints.into_iter()).collect::<Vec<Lint>>());
 }
 
 #[test]
diff --git a/clippy_dev/src/main.rs b/clippy_dev/src/main.rs
index 28f831a9b1c..d1161323b02 100644
--- a/clippy_dev/src/main.rs
+++ b/clippy_dev/src/main.rs
@@ -51,5 +51,5 @@ fn print_lints() {
         }
     }
 
-    println!("there are {} lints", Lint::active_lints(&lint_list).count());
+    println!("there are {} lints", Lint::active_lints(lint_list.into_iter()).count());
 }