-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sort the language listing #113
Conversation
src/main.rs
Outdated
@@ -226,7 +226,8 @@ fn run() -> Result<()> { | |||
let theme = assets.get_theme(config.theme.unwrap_or("Default"))?; | |||
|
|||
if app.matches.is_present("list-languages") { | |||
let languages = assets.syntax_set.syntaxes(); | |||
let mut languages = assets.syntax_set.syntaxes().to_owned(); | |||
languages.sort_by(|a, b| a.name.to_uppercase().cmp(&b.name.to_uppercase())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would sort_by_key
work here?
Something like
languages.sort_by_key(|s| s.name.to_uppercase())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. And which one do you prefer? How about sort_by_cached_key
? See rust-lang/rust#48639.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have to worry about performance here, so I would prefer sort_by_key
, since it is easier to read, in my opinion (sort_by_cached_key
is also fine, if it's already available in our minimum-required rustc version).
tests/tester.rs
Outdated
"tests/snapshots/sample.rs", | ||
&format!("--style={}", style), | ||
]) | ||
.args(&["tests/snapshots/sample.rs", &format!("--style={}", style)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently trying to fix this here: #114
5f7a2ab
to
c2df74b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much!
Closes #111.