]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/manual_ok_or.stderr
b4a17f143e3fce05ed999748c4f1bdc19983ec81
[rust.git] / src / tools / clippy / tests / ui / manual_ok_or.stderr
1 error: this pattern reimplements `Option::ok_or`
2   --> $DIR/manual_ok_or.rs:12:5
3    |
4 LL |     foo.map_or(Err("error"), |v| Ok(v));
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `foo.ok_or("error")`
6    |
7    = note: `-D clippy::manual-ok-or` implied by `-D warnings`
8
9 error: this pattern reimplements `Option::ok_or`
10   --> $DIR/manual_ok_or.rs:15:5
11    |
12 LL |     foo.map_or(Err("error"), Ok);
13    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `foo.ok_or("error")`
14
15 error: this pattern reimplements `Option::ok_or`
16   --> $DIR/manual_ok_or.rs:18:5
17    |
18 LL |     None::<i32>.map_or(Err("error"), |v| Ok(v));
19    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `None::<i32>.ok_or("error")`
20
21 error: this pattern reimplements `Option::ok_or`
22   --> $DIR/manual_ok_or.rs:22:5
23    |
24 LL | /     foo.map_or(Err::<i32, &str>(
25 LL | |         &format!(
26 LL | |             "{}{}{}{}{}{}{}",
27 LL | |             "Alice", "Bob", "Sarah", "Marc", "Sandra", "Eric", "Jenifer")
28 LL | |         ),
29 LL | |         |v| Ok(v),
30 LL | |     );
31    | |_____^
32    |
33 help: replace with
34    |
35 LL ~     foo.ok_or(&format!(
36 LL +         "{}{}{}{}{}{}{}",
37 LL ~         "Alice", "Bob", "Sarah", "Marc", "Sandra", "Eric", "Jenifer"));
38    |
39
40 error: aborting due to 4 previous errors
41