fix: unnecessary_to_owned FP when map key is a reference (#14834)

Closes rust-lang/rust-clippy#14833

changelog: [`unnecessary_to_owned`] fix FP when map key is a reference
This commit is contained in:
Samuel Tardieu 2025-05-18 19:49:20 +00:00 committed by GitHub
commit 375c65030b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 6 deletions

View file

@ -675,3 +675,9 @@ mod issue_14242 {
rc_slice_provider().to_vec().into_iter()
}
}
fn issue14833() {
use std::collections::HashSet;
let mut s = HashSet::<&String>::new();
s.remove(&"hello".to_owned());
}

View file

@ -675,3 +675,9 @@ mod issue_14242 {
rc_slice_provider().to_vec().into_iter()
}
}
fn issue14833() {
use std::collections::HashSet;
let mut s = HashSet::<&String>::new();
s.remove(&"hello".to_owned());
}