Open
Description
Code
fn fallible() -> Result<i32, ()> {
Ok(42)
}
pub fn caller() -> Result<(), ()> {
fallible();
Ok(())
}
Current output
warning: unused `Result` that must be used
--> src/lib.rs:6:5
|
6 | fallible();
| ^^^^^^^^^^
|
= note: this `Result` may be an `Err` variant, which should be handled
= note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
|
6 | let _ = fallible();
| +++++++
Desired output
Rust should suggest to add the missing `?`, not to ignore the error entirely.
Rationale and extra context
See rust-lang/miri#3855 for an example where ignoring the error with let _ =
can lead to critical bugs.
Other cases
No response
Rust Version
1.81.0
Anything else?
No response