Skip to content

Commit 5e38944

Browse files
authored
Merge pull request rust-lang#3295 from phansch/refactor_clippy_dev
Use `impl Iterator` in arg position in clippy_dev
2 parents 928a6d3 + 759ceb9 commit 5e38944

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clippy_dev/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ impl Lint {
5656
}
5757

5858
/// Returns all non-deprecated lints
59-
pub fn active_lints(lints: &[Self]) -> impl Iterator<Item=&Self> {
60-
lints.iter().filter(|l| l.deprecation.is_none())
59+
pub fn active_lints(lints: impl Iterator<Item=Self>) -> impl Iterator<Item=Self> {
60+
lints.filter(|l| l.deprecation.is_none())
6161
}
6262

6363
/// Returns the lints in a HashMap, grouped by the different lint groups
@@ -144,7 +144,7 @@ fn test_active_lints() {
144144
let expected = vec![
145145
Lint::new("should_assert_eq2", "Not Deprecated", "abc", None, "module_name")
146146
];
147-
assert_eq!(expected, Lint::active_lints(&lints).cloned().collect::<Vec<Lint>>());
147+
assert_eq!(expected, Lint::active_lints(lints.into_iter()).collect::<Vec<Lint>>());
148148
}
149149

150150
#[test]

clippy_dev/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ fn print_lints() {
5151
}
5252
}
5353

54-
println!("there are {} lints", Lint::active_lints(&lint_list).count());
54+
println!("there are {} lints", Lint::active_lints(lint_list.into_iter()).count());
5555
}

0 commit comments

Comments
 (0)