-
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
Clippy: Remove TyCtyt::super_traits_of
public comment and test behavior
#11097
Clippy: Remove TyCtyt::super_traits_of
public comment and test behavior
#11097
Conversation
…vior It turns out that the list of predicates used by `ty_is_fn_once_param` already includes super traits. The function would therefore not gain anything from using `TyCtyt::super_traits_of`. At least this PR removes that todo, reformats the function and adds a related test.
r? @Jarcho (rustbot has picked a reviewer for you, use r? to override) |
That note is still accurate. I'm not sure if |
Could you give an example for code that wouldn't work? I tested this (Playground): // Lint if `FnOnce` is a super trait
trait MySpecialFnMut: FnOnce() {}
impl<T: FnOnce()> MySpecialFnMut for T {}
fn f4(_: impl MySpecialFnMut) {}
let mut it = 0..10;
let x: Box<dyn MySpecialFnMut> = Box::new(|| {
while let Some(x) = it.next() {
if x % 2 == 0 {
break;
}
}
});
f4(x); and it lints just fine. I have the feeling I'm just overlooking something 😅 |
You're not missing anything. Looks like the closure's kind is now being set based on how it's used rather than how it's capable of being used. I guess the function can be removed then. |
☔ The latest upstream changes (presumably #11239) made this pull request unmergeable. Please resolve the merge conflicts. |
Hey, year sorry, I wasn't sure if I could just remove the function and then I lost track of it 🙈 I'll close this in favor of #11812, since that includes the suggested change. |
The
TyCtyt::super_traits_of
function is actually not needed. This PR removes the reference and adds a test as well :)changelog: none