Detect clippy diagnostic source#705
Conversation
|
|
||
| // A diagnostic source is quite likely to be clippy if it contains | ||
| // the further information link to the rust-clippy project. | ||
| if primary_message.contains("rust-clippy") { |
There was a problem hiding this comment.
minor nit: I think it'd be simpler if we would completely define it in one place like let source = if ... { "clippy" } else { "rustc" };
There was a problem hiding this comment.
Because the detection logic is in the main diagnostic building scope, yet applied to all secondary diagnostics too I think this is a fairly graceful way. That you could return the main diagnostic plus the source in a tuple and avoid the mut, and while I generally agree with avoiding mut I don't think there's much of a win here.
There was a problem hiding this comment.
Ah, you’re right - I got confused by partially unfolded code in between, my bad!
|
Oh, I'm sorry - it seems #681 made this unmergeable. Would you be so kind and rebase this? |
Update clippy to 0.0.186
1190283 to
3aae14e
Compare
|
Thanks! |
Adds source clippy, rather than rustc, when compiler messages include
"rust-clippy"(the project name part of the clippy more info links).While this method is fairly crude the chance of labelling an actual rustc error as clippy seems very low. As such this is definitely an improvement to what we have with little downside. Also since there isn't much code to it we can switch to a better source-detection method easily when one appears.
I've reworked the diagnostic message tests a little to aid source testing along with the new clippy diagnostic formatting regression test.