]> git.lizzy.rs Git - rust.git/blob - tests/ui/or_fun_call.stderr
Add test for or_fun_call macro suggestion
[rust.git] / tests / ui / or_fun_call.stderr
1 error: use of `unwrap_or` followed by a function call
2   --> $DIR/or_fun_call.rs:31:22
3    |
4 LL |     with_constructor.unwrap_or(make());
5    |                      ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)`
6    |
7    = note: `-D clippy::or-fun-call` implied by `-D warnings`
8
9 error: use of `unwrap_or` followed by a call to `new`
10   --> $DIR/or_fun_call.rs:34:5
11    |
12 LL |     with_new.unwrap_or(Vec::new());
13    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()`
14
15 error: use of `unwrap_or` followed by a function call
16   --> $DIR/or_fun_call.rs:37:21
17    |
18 LL |     with_const_args.unwrap_or(Vec::with_capacity(12));
19    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Vec::with_capacity(12))`
20
21 error: use of `unwrap_or` followed by a function call
22   --> $DIR/or_fun_call.rs:40:14
23    |
24 LL |     with_err.unwrap_or(make());
25    |              ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| make())`
26
27 error: use of `unwrap_or` followed by a function call
28   --> $DIR/or_fun_call.rs:43:19
29    |
30 LL |     with_err_args.unwrap_or(Vec::with_capacity(12));
31    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Vec::with_capacity(12))`
32
33 error: use of `unwrap_or` followed by a call to `default`
34   --> $DIR/or_fun_call.rs:46:5
35    |
36 LL |     with_default_trait.unwrap_or(Default::default());
37    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()`
38
39 error: use of `unwrap_or` followed by a call to `default`
40   --> $DIR/or_fun_call.rs:49:5
41    |
42 LL |     with_default_type.unwrap_or(u64::default());
43    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()`
44
45 error: use of `unwrap_or` followed by a function call
46   --> $DIR/or_fun_call.rs:52:14
47    |
48 LL |     with_vec.unwrap_or(vec![]);
49    |              ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| vec![])`
50
51 error: use of `unwrap_or` followed by a function call
52   --> $DIR/or_fun_call.rs:57:21
53    |
54 LL |     without_default.unwrap_or(Foo::new());
55    |                     ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(Foo::new)`
56
57 error: use of `or_insert` followed by a function call
58   --> $DIR/or_fun_call.rs:60:19
59    |
60 LL |     map.entry(42).or_insert(String::new());
61    |                   ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
62
63 error: use of `or_insert` followed by a function call
64   --> $DIR/or_fun_call.rs:63:21
65    |
66 LL |     btree.entry(42).or_insert(String::new());
67    |                     ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
68
69 error: use of `unwrap_or` followed by a function call
70   --> $DIR/or_fun_call.rs:66:21
71    |
72 LL |     let _ = stringy.unwrap_or("".to_owned());
73    |                     ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "".to_owned())`
74
75 error: use of `ok_or` followed by a function call
76   --> $DIR/or_fun_call.rs:70:17
77    |
78 LL |     let _ = opt.ok_or(format!("{} world.", hello));
79    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `ok_or_else(|| format!("{} world.", hello))`
80
81 error: aborting due to 13 previous errors
82