Closed
Description
What it does
Inspired also by:
rust-lang/rust#91626
In this code:
use std::collections::HashSet;
fn main() {
let mut s = HashSet::from(["a".to_string(), "b".to_string()]);
println!("{}", s.remove(&"b".to_string()));
}
I'd like Clippy to suggest to avoid the string allocation:
s.remove("b")
Similar suggestions are useful to HashMap, etc.
Lint Name
useless_string_allocation
Category
pedantic
Advantage
No response
Drawbacks
No response
Example
<code>
Could be written as:
<code>