-
Notifications
You must be signed in to change notification settings - Fork 1.7k
parsed_string_literals
: new lint
#14794
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
base: master
Are you sure you want to change the base?
parsed_string_literals
: new lint
#14794
Conversation
Is there any reason to limit linting this to just ip addresses? Any call to parse on a string literal has the same issue regardless of the type. The suggestion would have to be specialised per type so it could only exist for a subset of cases. Possibly a config to ignore specific types, but I'm not sure if this would be needed. |
I guess this could be extended, but at this stage I'm not sure we should make a generic lint for this. Specialized lints can be collectively renamed into a more generic one if we don't see one of them being disabled in isolation. I'd be more comfortable with a separate lint for the time being. In any case, I'll suspend this PR until rust-lang/rust#140976 is merged and synced to Clippy (hopefully tomorrow). @rustbot author |
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
ceb8d7f
to
938d056
Compare
Rebased to take advantage of the new diagnostic items. What about |
That sounds like a good name. |
This lint detects parsing of string literals into IP addresses when they are known correct.
938d056
to
ead8755
Compare
unnecessary_ip_addr_parse
: new lintparsed_string_literals
: new lint
This lint detects parsing of string literals into IP addresses when they are known correct.
changelog: [
parsed_string_literals
]: new lintInspired by this Zulip comment.