Rollup merge of #49525 - varkor:sort_by_cached_key-conversion, r=scottmcm
Use sort_by_cached_key where appropriate A follow-up to https://github.com/rust-lang/rust/pull/48639, converting various slice sorting calls to `sort_by_cached_key` when the key functions are more expensive.
This commit is contained in:
commit
77777b4528
17 changed files with 33 additions and 34 deletions
|
@ -689,7 +689,7 @@ impl<'a> Parser<'a> {
|
|||
.chain(inedible.iter().map(|x| TokenType::Token(x.clone())))
|
||||
.chain(self.expected_tokens.iter().cloned())
|
||||
.collect::<Vec<_>>();
|
||||
expected.sort_by(|a, b| a.to_string().cmp(&b.to_string()));
|
||||
expected.sort_by_cached_key(|x| x.to_string());
|
||||
expected.dedup();
|
||||
let expect = tokens_to_string(&expected[..]);
|
||||
let actual = self.this_token_to_string();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue