-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't
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
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't