- Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when applied
Description
Summary
When running the code snippet from the 2024 edition guide it triggers the unused_unit
lint, even though removing the type annotation will make the code stop compiling.
Encountered in bevyengine/bevy#18778
Lint Name
unused_unit
Reproducer
trait Unit {} impl Unit for () {} fn run<R: Unit>(f: impl FnOnce() -> R) { f(); } fn main() { run(|| -> () { todo!() }); }
Output
warning: unneeded unit return type --> src/main.rs:12:11 | 12 | run(|| -> () { todo!() }); | ^^^^^^ help: remove the `-> ()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit = note: `#[warn(clippy::unused_unit)]` on by default
Version
Additional Labels
No response
OvermindDL1
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when applied