-
Notifications
You must be signed in to change notification settings - Fork 13.4k
code suggestions for unused-mut, while-true, deprecated-attribute, and unused-parens lints #44942
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
`CodeSuggestion` doesn't live in the `diagnostic` module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nitpicks, r=me once you deal with the first two.
src/librustc_lint/builtin.rs
Outdated
"denote infinite loops with loop { ... }"); | ||
let msg = "denote infinite loops with `loop { ... }`"; | ||
let mut err = cx.struct_span_lint(WHILE_TRUE, | ||
e.span, msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fits in one line?
src/librustc_lint/builtin.rs
Outdated
e.span, msg); | ||
let condition_span = cx.tcx.sess.codemap().def_span(e.span); | ||
err.span_suggestion_short(condition_span, "use `loop`", | ||
"loop".to_owned()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When all arguments don't fit, I like to keep one line per argument (indented to the first one in the same line as the method).
let mut err = cx.struct_span_lint(UNUSED_PARENS, | ||
value.span, | ||
&span_msg); | ||
// Remove exactly one pair of parentheses (rather than naïvely |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikomatsakis do we care about unicode in rustc comments?
15f4aa1
to
289faf5
Compare
(force-pushed to address formatting review comments) |
Also, fix the deprecation message for the late no-debug feature.
289faf5
to
a399757
Compare
(updated again to fix compile-fail failures reported by Travis) |
@bors r+ Thanks @zachreizner, great work! |
📌 Commit a399757 has been approved by |
⌛ Testing commit a3997577226db861d103d27da91a77acf9fd4b3e with merge 7a521317b909286b51aa36af0dee6cbd7a5cc6c0... |
I agree; @zachreizner is the best! I especially like the one where he fixed the shift-right docs; it must have taken a very careful eye to catch that! 😉 |
Not the first time I've been thanked in place of a a fellow Zach :-). I think my handle just comes up before the Zack Zach-s in the autocomplete. |
💔 Test failed - status-appveyor |
Appveyor/Windows apparently doesn't like the |
a399757
to
fa8802a
Compare
I believe we're really trying to move away from
|
fa8802a
to
979671e
Compare
output normalization issue is #44968; updated tip of PR with ignore-windows is 979671ec |
979671e
to
8a14022
Compare
correction, PR is 8a14022 |
@bors r+ rollup |
📌 Commit 8a14022 has been approved by |
code suggestions for unused-mut, while-true, deprecated-attribute, and unused-parens lints  r? @estebank
☀️ Test successful - status-appveyor, status-travis |
code suggestions for non-shorthand field pattern, no-mangle lints continuing in the spirit of #44942  r? @estebank
code suggestions for non-shorthand field pattern, no-mangle lints continuing in the spirit of #44942  r? @estebank
code suggestions for non-shorthand field pattern, no-mangle lints continuing in the spirit of #44942  r? @estebank
r? @estebank