diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/tests/ui/manual_find.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/manual_find.rs b/src/tools/clippy/tests/ui/manual_find.rs new file mode 100644 index 000000000..257fe045f --- /dev/null +++ b/src/tools/clippy/tests/ui/manual_find.rs @@ -0,0 +1,22 @@ +#![allow(unused)] +#![warn(clippy::manual_find)] + +fn vec_string(strings: Vec<String>) -> Option<String> { + for s in strings { + if s == String::new() { + return Some(s); + } + } + None +} + +fn tuple(arr: Vec<(String, i32)>) -> Option<String> { + for (s, _) in arr { + if s == String::new() { + return Some(s); + } + } + None +} + +fn main() {} |