Skip to content
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

regex_macro false positive #2586

Closed
CAD97 opened this issue Mar 29, 2018 · 3 comments · Fixed by #5760
Closed

regex_macro false positive #2586

CAD97 opened this issue Mar 29, 2018 · 3 comments · Fixed by #5760
Assignees
Labels
E-help-wanted Call for participation: Help is requested to fix this issue. good-first-issue These issues are a good way to get started with Clippy

Comments

@CAD97
Copy link
Contributor

CAD97 commented Mar 29, 2018

When defining a custom regex! macro to use the lazy_static pattern more easily, the regex_macro picks it up.

This occurs with nom and any of it's re_*_static! macros, as they all expand to use an internal (hidden) regex! macro, which then expands to the lazy_static! macro.

@oli-obk
Copy link
Contributor

oli-obk commented Mar 29, 2018

uuuuh... Not sure how to solve this. We do detect the regex macro via its name... We might be able to not trigger the lint if there is no #[macro_use] extern crate regex; anywhere

@phansch phansch added C-bug Category: Clippy is not doing the correct thing E-hard Call for participation: This a hard problem and requires more experience or effort to work on T-macros Type: Issues with macros and macro expansion labels Apr 9, 2018
@pickfire
Copy link
Contributor

Oh, look like we implement our own regex! macro to use lazy_static too but it have this false positive. Maybe we could check for #[macro_use] or the newer use regex::regex;?

@CAD97
Copy link
Contributor Author

CAD97 commented Jun 16, 2020

Or even just deprecate the lint, honestly. The regex crate hasn't provided the old regex macro for a long time.

@flip1995 flip1995 added good-first-issue These issues are a good way to get started with Clippy E-help-wanted Call for participation: Help is requested to fix this issue. and removed E-hard Call for participation: This a hard problem and requires more experience or effort to work on C-bug Category: Clippy is not doing the correct thing T-macros Type: Issues with macros and macro expansion labels Jun 22, 2020
@phansch phansch self-assigned this Jun 28, 2020
@bors bors closed this as completed in 52cc5fc Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-help-wanted Call for participation: Help is requested to fix this issue. good-first-issue These issues are a good way to get started with Clippy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants