Skip to content

Conversation

terry90
Copy link
Contributor

@terry90 terry90 commented May 28, 2018

Fixes #2300

@terry90 terry90 changed the title unreadable_literal: Fills hexadecimal values with 0 to allow grouping unreadable_literal: Fills hexadecimal values with 0 to allow better grouping May 28, 2018
@flip1995
Copy link
Member

flip1995 commented Jun 2, 2018

Thanks for the contribution and welcome to clippy!

This lgtm, but since I'm new to this reviewing thing: @oli-obk ? 😄

.collect::<Vec<String>>()
.join("_");
// Forces hexadecimal values to be grouped by 4 being filled with zeroes (e.g 0x00ab_cdef)
let nb_digits_to_fill = self.digits.chars().filter(|&c| c != '_').collect::<Vec<_>>().len() % 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is almost doing the same thing as what's happening above, can you store the intermediate Vec from above in a variable and reuse it here? The reversion above is irrelevant for counting.

@terry90
Copy link
Contributor Author

terry90 commented Jun 3, 2018

@oli-obk done ! 👍

@oli-obk
Copy link
Contributor

oli-obk commented Jun 3, 2018

great!

@oli-obk oli-obk merged commit c6d53ad into rust-lang:master Jun 3, 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.

3 participants