mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-26 22:50:56 +00:00
22 lines
492 B
Rust
22 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);
|
||
|
}
|