Closed
Description
Summary
There is a pattern that does not work even though needless_return is enabled.
Lint Name
needless_return
Reproducer
I tried this code:
#![warn(clippy::needless_return)]
const WORDS: [&[&str]; 2] = [&["foo"], &["bar"]];
fn main() {
println!("{:?}", issue());
}
fn issue() -> bool {
return WORDS.iter().any(|&word| word == ["foo"]);
}
I expected to see this happen: There should be a suggestion as above follows.
fn issue() -> bool {
WORDS.iter().any(|&word| word == ["foo"])
}
Instead, this happened: No happen.
Version
rustc 1.61 (stable)
clippy 1.63