Fix more false positives for extra_unused_type_parameters#10392
Fix more false positives for extra_unused_type_parameters#10392bors merged 1 commit intorust-lang:masterfrom
extra_unused_type_parameters#10392Conversation
|
@flip1995 would be great if this can make it in before today's sync. A |
Jarcho
left a comment
There was a problem hiding this comment.
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 |
flip1995
left a comment
There was a problem hiding this comment.
@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.
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.
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.
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.
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.
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_apiconfig option.r? @flip1995
changelog: none