Merge pull request #3295 from phansch/refactor_clippy_dev

Use `impl Iterator` in arg position in clippy_dev
This commit is contained in:
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer 2018-10-11 09:20:20 +02:00 committed by GitHub
commit 5e38944ebe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -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]

View file

@ -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());
}