-
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
Add empty closure lint #5355
Add empty closure lint #5355
Conversation
☔ The latest upstream changes (presumably #5319) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #5380) made this pull request unmergeable. Please resolve the merge conflicts. |
I'm not 100% convinced this is a necessary lint, do people ever write this? |
/// ```rust | ||
/// std::thread::spawn(|| {}); | ||
/// ``` | ||
pub EMPTY_CLOSURE, |
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.
the name should probably be spawn_empty_closure
/// ``` | ||
pub EMPTY_CLOSURE, | ||
style, | ||
"closure with empty body" |
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.
this should probably mention spawning
Me neither. I guess people don't (or they don't read their code after refactoring). Anyway if people are not convinced, we should just close the issue and this PR, it's totally fine. |
Sounds good. Let me know if you want to find something else to work on. We do have a couple issues like this where we filed stuff but weren't yet sure if we wanted them, sorry about that. |
This PR adds a lint that triggers spawned empty closures.
Fixes: #625
changelog: Add empty closure lint