-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add lint almost_complete_digit_range
#10043
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Jarcho (or someone else) soon. Please see the contribution instructions for more information. |
Just a comment on naming. It would be better to rename Might be easier to start from |
While making the change you suggested I ran into an issue I hope you can shed some light on. If you run the test |
I'm surprised the compiler isn't complaining about that. Only the first arm of that macro will ever be expanded. You probably meant to do something like macro_rules! b {
() => {{
let _ = 'a'..'z';
let _ = 'A'..'Z';
let _ = '0'..'9';
}};
} |
Oh, woops. Looks like rustc and I are equally good at noticing when a macro definition is wrong. |
Looks good to go. You can squash the changes. Probably best to have the rename as a separate commit, but not necessary if that's too much effort. |
This replaces and expands `almost_complete_letter_range`.
Weird. I wonder what you did. Thank you. @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
changelog: [
almost_complete_digit_range
]: Add digit analog toalmost_complete_letter_range
I have added a lint that will detect
'0'..'9'
and suggest converting it to'0'..='9'
, the same wayalmost_complete_letter_range
does for ascii letters. I tied into the implementation ofAlmostCompleteLetterRange
in order to do that, but I didn't change its interface.This is my first contribution to Clippy, so please let me know if there's anything I should do differently. I'll be happy to incorporate any suggestions you have.
Thanks!