-
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
Fix more false positives for extra_unused_type_parameters
#10392
Conversation
@flip1995 would be great if this can make it in before today's sync. A |
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.
Quick review. Let's see if we can get this in today.
fd3da4d
to
528bb63
Compare
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
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.
@mkrasnitski Awesome work, thanks for implementing this so quickly. Really a pleasure working with you!
I have two more comments, but they are just NITs. This unblocks the sync. Thanks for helping review @Jarcho
|
||
/// Don't lint external macros or functions with empty bodies. Also, don't lint public items if | ||
/// the `avoid_breaking_exported_api` config option is set. | ||
fn check_false_positive(&self, cx: &LateContext<'_>, span: Span, def_id: LocalDefId, body_id: BodyId) -> bool { |
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.
Weird function name IMO. But the best thing I can come up with is: is_exported_macro_or_empty
.
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.
yeah, names are hard... I couldn't really come up with anything satisfactory either. Maybe is_empty_exported_or_macro
is the least ambiguous.
fn unused_with_priv_trait_bound<T: private::Private, U>() { | ||
unimplemented!(); | ||
} | ||
} |
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.
Maybe I missed it, but I think there is a test for a pub
function missing (should not get linted).
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.
As far as I can tell, that relies on the config option, right? Does uitest
try different values of config vars as listed in clippy.toml
?
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.
Have a look in the test/ui-toml
dir on how to test different config values.
Glad to hear this made it in time. I have plans to try using |
Builds on #10321. All empty functions are no longer linted, instead of just those that have trait bounds on them. Also, if a trait bound contains a non-public trait (un-exported, but still potentially reachable), then the corresponding type parameter isn't linted.
Finally, added support for the
avoid_breaking_exported_api
config option.r? @flip1995
changelog: none