mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-22 20:53:21 +00:00
21 lines
492 B
Rust
21 lines
492 B
Rust
#![warn(clippy::map_all_any_identity)]
|
|
|
|
fn main() {
|
|
let _ = ["foo"].into_iter().any(|s| s == "foo");
|
|
//~^ map_all_any_identity
|
|
let _ = ["foo"].into_iter().all(|s| s == "foo");
|
|
//~^ map_all_any_identity
|
|
|
|
//
|
|
// Do not lint
|
|
//
|
|
// Not identity
|
|
let _ = ["foo"].into_iter().map(|s| s.len()).any(|n| n > 0);
|
|
// Macro
|
|
macro_rules! map {
|
|
($x:expr) => {
|
|
$x.into_iter().map(|s| s == "foo")
|
|
};
|
|
}
|
|
map!(["foo"]).any(|a| a);
|
|
}
|