Closed
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