]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/result_map_unit_fn_unfixable.stderr
iterate List by value
[rust.git] / tests / ui / result_map_unit_fn_unfixable.stderr
index 16caac5828afe6ba3b2f5e6ecafd65e2f40ac1b2..b23cc608621d0fa3880ac27766d86d6349c5a76d 100644 (file)
@@ -1,27 +1,58 @@
-error[E0425]: cannot find value `x` in this scope
-  --> $DIR/result_map_unit_fn_unfixable.rs:16:5
+error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type
+  --> $DIR/result_map_unit_fn_unfixable.rs:23:5
    |
 LL |     x.field.map(|value| { do_nothing(value); do_nothing(value) });
-   |     ^ not found in this scope
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
+   |     |
+   |     help: try this: `if let Ok(value) = x.field { ... }`
+   |
+   = note: `-D clippy::result-map-unit-fn` implied by `-D warnings`
 
-error[E0425]: cannot find value `x` in this scope
-  --> $DIR/result_map_unit_fn_unfixable.rs:18:5
+error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type
+  --> $DIR/result_map_unit_fn_unfixable.rs:25:5
    |
 LL |     x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
-   |     ^ not found in this scope
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
+   |     |
+   |     help: try this: `if let Ok(value) = x.field { ... }`
 
-error[E0425]: cannot find value `x` in this scope
-  --> $DIR/result_map_unit_fn_unfixable.rs:22:5
+error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type
+  --> $DIR/result_map_unit_fn_unfixable.rs:29:5
    |
-LL |     x.field.map(|value| {
-   |     ^ not found in this scope
+LL |        x.field.map(|value| {
+   |   _____^
+   |  |_____|
+   | ||
+LL | ||         do_nothing(value);
+LL | ||         do_nothing(value)
+LL | ||     });
+   | ||______^- help: try this: `if let Ok(value) = x.field { ... }`
+   | |_______|
+   | 
 
-error[E0425]: cannot find value `x` in this scope
-  --> $DIR/result_map_unit_fn_unfixable.rs:26:5
+error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type
+  --> $DIR/result_map_unit_fn_unfixable.rs:33:5
    |
 LL |     x.field.map(|value| { do_nothing(value); do_nothing(value); });
-   |     ^ not found in this scope
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
+   |     |
+   |     help: try this: `if let Ok(value) = x.field { ... }`
+
+error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type
+  --> $DIR/result_map_unit_fn_unfixable.rs:37:5
+   |
+LL |     "12".parse::<i32>().map(diverge);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
+   |     |
+   |     help: try this: `if let Ok(a) = "12".parse::<i32>() { diverge(a) }`
+
+error: called `map(f)` on an `Result` value where `f` is a function that returns the unit type
+  --> $DIR/result_map_unit_fn_unfixable.rs:43:5
+   |
+LL |     y.map(do_nothing);
+   |     ^^^^^^^^^^^^^^^^^-
+   |     |
+   |     help: try this: `if let Ok(_y) = y { do_nothing(_y) }`
 
-error: aborting due to 4 previous errors
+error: aborting due to 6 previous errors
 
-For more information about this error, try `rustc --explain E0425`.