]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/sugg-else-for-closure.stderr
Auto merge of #106696 - kylematsuda:early-binder, r=lcnr
[rust.git] / tests / ui / suggestions / sugg-else-for-closure.stderr
1 error[E0308]: mismatched types
2   --> $DIR/sugg-else-for-closure.rs:6:26
3    |
4 LL |     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]`
11 help: 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    |
14 LL |     let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap());
15    |              ^^^^^^^^^^^^-------------------------------^
16    |                          |
17    |                          this argument influences the return type of `unwrap_or`
18 note: associated function defined here
19   --> $SRC_DIR/core/src/option.rs:LL:COL
20 help: try calling `unwrap_or_else` instead
21    |
22 LL |     let _s = y.unwrap_or_else(|| x.split('.').nth(1).unwrap());
23    |                         +++++
24
25 error: aborting due to previous error
26
27 For more information about this error, try `rustc --explain E0308`.