rust-clippy/tests/ui/unnecessary_lazy_eval_unfixable.stderr

49 lines
1.6 KiB
Text
Raw Normal View History

error: unnecessary closure used to substitute value for `Result::Err`
2024-02-17 12:16:29 +00:00
--> tests/ui/unnecessary_lazy_eval_unfixable.rs:13:13
|
LL | let _ = Ok(1).unwrap_or_else(|()| 2);
2024-08-24 10:43:00 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_lazy_evaluations)]`
2024-08-24 10:43:00 +00:00
help: use `unwrap_or` instead
|
LL | let _ = Ok(1).unwrap_or(2);
| ~~~~~~~~~~~~
error: unnecessary closure used to substitute value for `Result::Err`
2024-02-17 12:16:29 +00:00
--> tests/ui/unnecessary_lazy_eval_unfixable.rs:19:13
|
LL | let _ = Ok(1).unwrap_or_else(|e::E| 2);
2024-08-24 10:43:00 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `unwrap_or` instead
|
LL | let _ = Ok(1).unwrap_or(2);
| ~~~~~~~~~~~~
error: unnecessary closure used to substitute value for `Result::Err`
2024-02-17 12:16:29 +00:00
--> tests/ui/unnecessary_lazy_eval_unfixable.rs:21:13
|
LL | let _ = Ok(1).unwrap_or_else(|SomeStruct { .. }| 2);
2024-08-24 10:43:00 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `unwrap_or` instead
|
LL | let _ = Ok(1).unwrap_or(2);
| ~~~~~~~~~~~~
error: unnecessary closure used with `bool::then`
2024-02-17 12:16:29 +00:00
--> tests/ui/unnecessary_lazy_eval_unfixable.rs:31:13
|
LL | let _ = true.then(|| -> &[u8] { &[] });
2024-08-24 10:43:00 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `then_some` instead
|
LL | let _ = true.then_some({ &[] });
| ~~~~~~~~~~~~~~~~~~
error: aborting due to 4 previous errors