Don't lint various match lints when expanded by a proc-macro by Jarcho · Pull Re...
source link: https://github.com/rust-lang/rust-clippy/pull/8667
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
New issue
Don't lint various match lints when expanded by a proc-macro #8667
Conversation
fixes #4952
As always for proc-macro output this is a hack-job of a fix. It would be really nice if more proc-macro authors would set spans correctly.
changelog: Don't lint various lints on proc-macro output.
r? @flip1995
(rust-highfive has picked a reviewer for you, use r? to override)
added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label
LGTM, small comment on the utils function.
fn helper(sm: &SourceMap, span: Span, text: &str) -> bool {
let pos = sm.lookup_byte_offset(span.lo());
Removing this helper function would only change this line inside the whole helper function
but we save a level of indentation and an inner function
It's to deal with duplication due to monomorphization on the lint context.
Shouldn't that just get optimized out by the outliner or other opt passes?
Just checked: it doesn't. This saves around 1 kB in code size.
@bors r+
Thanks!
Commit 63f6a79 has been approved by flip1995
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
None yet
No milestone
Successfully merging this pull request may close these issues.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK