Skip to content

Conversation

@rleungx
Copy link
Contributor

@rleungx rleungx commented May 14, 2018

Closes #111.

src/main.rs Outdated
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()));
Copy link
Owner

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

Copy link
Contributor Author

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.

Copy link
Owner

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/snapshots/sample.rs",
&format!("--style={}", style),
])
.args(&["tests/snapshots/sample.rs", &format!("--style={}", style)])
Copy link
Owner

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

@rleungx rleungx force-pushed the sort-the-language-listing branch from 5f7a2ab to c2df74b Compare May 14, 2018 17:50
Copy link
Owner

@sharkdp sharkdp left a 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!

@sharkdp sharkdp merged commit a5de77a into sharkdp:master May 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants