use sort_unstable to sort primitive types
It's not important to retain original order if we have &[1, 1, 2, 3] for example. clippy::stable_sort_primitive
This commit is contained in:
parent
d92155bf6a
commit
b4935e0726
6 changed files with 16 additions and 9 deletions
|
@ -103,6 +103,7 @@ fn find_match_by_sorted_words<'a>(iter_names: Vec<&'a Symbol>, lookup: &str) ->
|
|||
|
||||
fn sort_by_words(name: &str) -> String {
|
||||
let mut split_words: Vec<&str> = name.split('_').collect();
|
||||
split_words.sort();
|
||||
// We are sorting primitive &strs and can use unstable sort here
|
||||
split_words.sort_unstable();
|
||||
split_words.join("_")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue