-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[unnecessary_lazy_eval
] Do not lint in external macros
#9486
Conversation
r? @giraffate (rust-highfive has picked a reviewer for you, use r? to override) |
Thanks, I've identified the source of the false positive in rocket codebase: https://github.com/SergioBenitez/Rocket/blob/707936177a7fea6d8eca103cf0b3601ca45fe657/core/codegen/src/derive/from_form.rs#L287 Following your example I've tried to reproduce the issue with a dummy derive macro #[proc_macro_derive(LazyEvalDerive)]
pub fn unnecessary_lazy_eval(_: TokenStream) -> TokenStream {
quote!(
pub fn unnecessary_then() {
Some(1).unwrap_or_else(|| 2); // should not lint because in external macro
}
)
} but it's not linting it even before my patch, so unlikely my fix is working as intended |
The fix for this needs |
4cbd911
to
f289353
Compare
☔ The latest upstream changes (presumably #9551) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks for this!
@giraffate Hope you don't mind me stealing this review 😁
@bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
fix #9485, fix #9439
I didn't find a way to add a test since fps occur due to an external crate.
changelog: [
unnecessary_lazy_eval
] Do not lint in external macros