fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.2 KiB27 linesraw
1error[E0308]: mismatched types
2  --> $DIR/sugg-else-for-closure.rs:6:26
3   |
4LL |     let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap());
5   |                --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&str`, found closure
6   |                |
7   |                arguments to this method are incorrect
8   |
9   = note: expected reference `&str`
10                found closure `{closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28}`
11help: the return type of this call is `{closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28}` due to the type of the argument passed
12  --> $DIR/sugg-else-for-closure.rs:6:14
13   |
14LL |     let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap());
15   |              ^^^^^^^^^^^^-------------------------------^
16   |                          |
17   |                          this argument influences the return type of `unwrap_or`
18note: method defined here
19  --> $SRC_DIR/core/src/option.rs:LL:COL
20help: try calling `unwrap_or_else` instead
21   |
22LL |     let _s = y.unwrap_or_else(|| x.split('.').nth(1).unwrap());
23   |                         +++++
24
25error: aborting due to previous error
26
27For more information about this error, try `rustc --explain E0308`.