-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messages
Description
What it does
Inspired by this issue:
rust-lang/rust#91625
In code like this:
fn main() {
let s = "abc".to_string();
let t = s.strip_prefix(&['a', 'x'][..]);
println!("{:?}", t);
}Clippy could suggest to write instead:
s.strip_prefix(&['a', 'x'])Or even:
s.strip_prefix(['a', 'x'])Lint Name
No response
Category
No response
Advantage
No response
Drawbacks
No response
Example
<code>Could be written as:
<code>Metadata
Metadata
Assignees
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messages