-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
mut_mut triggers for regex! macro #67
Comments
I think it may not be too problematic and in fact makes a lot of sense: We should watch out for macro expansion and (perhaps optionally) if the macro is external to the current crate, omit the warning. |
That sounds good. We can pick up the syntaxcontext of idents and stuff I think. If an ident is not doc.rust-lang.org/syntax/ast/constant.EMPTY_CTXT.html, we ignore it. Not sure though. |
We may want to look up if the macro is defined in the current crate, and issue a warning in that case anyway. |
I'm not sure if that info is kept around post-expansion in an easy-to-access manner. The spans might help here. |
I'm curious how the compiler does it when reporting errors – it always tells me which macro was expanded. Looking into the code, the code map has a function we may be able to use. I'll push an untested prototype into a 'macro_expn' branch. However, I'm not sure if we should include regex! as a test dependency or if there is another alternative. |
@killercup: Are you ok with me reusing your line of code as a test case? I may be able to reduce it, but it's the best starting point we have. |
@llogiq Sure, you can reproduce about a gazillion lines of this when you compile trpl-ebook with |
In PR #68 I have added a better Note that this enables you to write e.g. |
The latest merged PR #82 makes this issue go away (as well as similar issues in other lints) |
I just came across this warning:
This does not seem very useful. (I totally understand why this can be problematic to fix in clippy, though.)
The text was updated successfully, but these errors were encountered: