Convert sort_by to sort_by_cached_key

This commit is contained in:
varkor 2018-03-30 10:54:14 +01:00
parent 5cd0504d10
commit 57eedbaaf8
3 changed files with 5 additions and 9 deletions

View file

@ -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();