Skip to content
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

Add the from_str_radix_10 lint #6717

Merged
merged 10 commits into from
Feb 20, 2021
Merged

Add the from_str_radix_10 lint #6717

merged 10 commits into from
Feb 20, 2021

Conversation

booleancoercion
Copy link
Contributor

changelog: added the new from_str_radix_10 which sometimes replaces calls to primitive::from_str_radix to str::parse

This is ready to be merged, although maybe the category should be pedantic instead of style? I'm not sure where it fits better.

Closes #6713.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @llogiq (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 11, 2021
/// let num: u16 = input.parse()?;
/// ```
pub FROM_STR_RADIX_10,
style,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think style is OK, as I don't expect any false positives here.

@llogiq
Copy link
Contributor

llogiq commented Feb 12, 2021

This is a good start. Just some suggestions to improve it even more, then I think we can unleash it on our users. 😄

@booleancoercion
Copy link
Contributor Author

Thanks, @llogiq - if you could only take a final look, that'd be great.

@llogiq
Copy link
Contributor

llogiq commented Feb 13, 2021

I'm a bit unclear about possible incorrectness of the suggestion. Otherwise this looks good and I'll r+ this once I understand it.

@booleancoercion
Copy link
Contributor Author

Well, nevermind the possible incorrectness..

@booleancoercion
Copy link
Contributor Author

booleancoercion commented Feb 19, 2021

Now it's really done, @llogiq. I didn't want to implement a workaround for #6767 since fixing that issue will fix this and other lints anyway, and it hardly changes anything. Definitely doesn't have to do with correctness in any case, so I don't think it's blocking.

@llogiq
Copy link
Contributor

llogiq commented Feb 20, 2021

Thank you! @bors r+

@bors
Copy link
Collaborator

bors commented Feb 20, 2021

📌 Commit c4b8d87 has been approved by llogiq

@bors
Copy link
Collaborator

bors commented Feb 20, 2021

⌛ Testing commit c4b8d87 with merge 67087a1...

@bors
Copy link
Collaborator

bors commented Feb 20, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing 67087a1 to master...

@bors bors merged commit 67087a1 into rust-lang:master Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lint towards replacing from_str_radix with str::parse when the radix is 10
6 participants