Use structured suggestions for nonstandard style lints#57387
Use structured suggestions for nonstandard style lints#57387bors merged 4 commits intorust-lang:masterfrom
Conversation
|
r? @davidtwco (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
4179fb7 to
81fd363
Compare
There was a problem hiding this comment.
you can just add a ? to the initializer of left and right instead of pattern matching.
There was a problem hiding this comment.
While I generally have nothing against this, I'm wondering if we should do an in_macro in the lint instead.
There was a problem hiding this comment.
I think the diagnostic is already not reported in macros? Is this just something funky with syntax extensions?
There was a problem hiding this comment.
Oh, right. So it's probably https://github.com/rust-lang/rust/blob/81fd3631c499799afb4bae968a21796eaf5d5c4f/src/libsyntax/diagnostics/plugin.rs#L120 using a dummy span instead of the span from https://github.com/rust-lang/rust/blob/81fd3631c499799afb4bae968a21796eaf5d5c4f/src/libsyntax/diagnostics/plugin.rs#L65
There was a problem hiding this comment.
with_empty_ctxt already creates an identifier with a dummy span, so won't the lint get triggered anyways? Seems eaiser to me to just allow the lint 😅 I think that's what happened with lint failures inside format!: they were just fixed.
There was a problem hiding this comment.
So... if it's a dummy, why is the lint triggered at all? Did you maybe do this change before you added the dummy check and the allow is now not necessary anymore?
There was a problem hiding this comment.
Ok, I was able to fix this by ensuring the syntax extensions use the call-site span with a macro expansion mark instead of just call-site span.
To clarify what I said earlier, the dummy check that I added only ensures that the suggestion gets added, not that the lint fires. span_helps don't get emitted with a dummy span, but the lint will. This issue had nothing to do with the dummy span check.
There was a problem hiding this comment.
Thanks! That also explains why the lint suddenly started getting reported.
81fd363 to
9e436f9
Compare
Use a structured suggestion and tighten the span to just the identifier.
Use a structured suggestion and tighten the span to just the identifier.
Use a structured suggestion and tighten the span to just the identifier.
9e436f9 to
1b28f5a
Compare
|
@bors r+ |
|
📌 Commit 1b28f5a has been approved by |
|
⌛ Testing commit 1b28f5a with merge 59f835d7d79326242a9cfba0fbfd96c0e39f07b5... |
|
💔 Test failed - status-appveyor |
|
@bors retry |
Use structured suggestions for nonstandard style lints This PR modifies the lints in the nonstandard_style group to use structured suggestions. Note that there's a bit of tricky span calculation going on for the `crate_name` attribute. It also simplifies the code a bit: I don't think the "fallback" suggestions for these lints can actually be triggered. Fixes #48103. Fixes #52414.
|
☀️ Test successful - checks-travis, status-appveyor |
This PR modifies the lints in the nonstandard_style group to use structured suggestions. Note that there's a bit of tricky span calculation going on for the
crate_nameattribute. It also simplifies the code a bit: I don't think the "fallback" suggestions for these lints can actually be triggered.Fixes #48103.
Fixes #52414.