mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-28 07:30:57 +00:00
52 lines
1.6 KiB
Text
52 lines
1.6 KiB
Text
error: ignoring a result with `.ok()` is misleading
|
|
--> tests/ui/unused_result_ok.rs:9:5
|
|
|
|
|
LL | x.parse::<u32>().ok();
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::unused-result-ok` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::unused_result_ok)]`
|
|
help: consider using `let _ =` and removing the call to `.ok()` instead
|
|
|
|
|
LL | let _ = x.parse::<u32>();
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
error: ignoring a result with `.ok()` is misleading
|
|
--> tests/ui/unused_result_ok.rs:18:5
|
|
|
|
|
LL | x . parse::<i32>() . ok ();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: consider using `let _ =` and removing the call to `.ok()` instead
|
|
|
|
|
LL | let _ = x . parse::<i32>();
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
error: ignoring a result with `.ok()` is misleading
|
|
--> tests/ui/unused_result_ok.rs:34:5
|
|
|
|
|
LL | v!().ok();
|
|
| ^^^^^^^^^
|
|
|
|
|
help: consider using `let _ =` and removing the call to `.ok()` instead
|
|
|
|
|
LL | let _ = v!();
|
|
| ~~~~~~~~~~~~
|
|
|
|
error: ignoring a result with `.ok()` is misleading
|
|
--> tests/ui/unused_result_ok.rs:29:9
|
|
|
|
|
LL | Ok::<(), ()>(()).ok();
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | w!();
|
|
| ---- in this macro invocation
|
|
|
|
|
= note: this error originates in the macro `w` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
help: consider using `let _ =` and removing the call to `.ok()` instead
|
|
|
|
|
LL | let _ = Ok::<(), ()>(());
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
error: aborting due to 4 previous errors
|
|
|