]> git.lizzy.rs Git - rust.git/blob - tests/ui/unnecessary_lazy_eval.stderr
Auto merge of #5980 - matsujika:create-dir, r=flip1995
[rust.git] / tests / ui / unnecessary_lazy_eval.stderr
1 error: unnecessary closure used to substitute value for `Option::None`
2   --> $DIR/unnecessary_lazy_eval.rs:34:13
3    |
4 LL |     let _ = opt.unwrap_or_else(|| 2);
5    |             ^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `opt.unwrap_or(2)`
6    |
7    = note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D warnings`
8
9 error: unnecessary closure used to substitute value for `Option::None`
10   --> $DIR/unnecessary_lazy_eval.rs:35:13
11    |
12 LL |     let _ = opt.unwrap_or_else(|| astronomers_pi);
13    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `opt.unwrap_or(astronomers_pi)`
14
15 error: unnecessary closure used to substitute value for `Option::None`
16   --> $DIR/unnecessary_lazy_eval.rs:36:13
17    |
18 LL |     let _ = opt.unwrap_or_else(|| ext_str.some_field);
19    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `opt.unwrap_or(ext_str.some_field)`
20
21 error: unnecessary closure used to substitute value for `Option::None`
22   --> $DIR/unnecessary_lazy_eval.rs:37:13
23    |
24 LL |     let _ = opt.unwrap_or_else(|| ext_arr[0]);
25    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `opt.unwrap_or(ext_arr[0])`
26
27 error: unnecessary closure used to substitute value for `Option::None`
28   --> $DIR/unnecessary_lazy_eval.rs:38:13
29    |
30 LL |     let _ = opt.and_then(|_| ext_opt);
31    |             ^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `opt.and(ext_opt)`
32
33 error: unnecessary closure used to substitute value for `Option::None`
34   --> $DIR/unnecessary_lazy_eval.rs:39:13
35    |
36 LL |     let _ = opt.or_else(|| ext_opt);
37    |             ^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `opt.or(ext_opt)`
38
39 error: unnecessary closure used to substitute value for `Option::None`
40   --> $DIR/unnecessary_lazy_eval.rs:40:13
41    |
42 LL |     let _ = opt.or_else(|| None);
43    |             ^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `opt.or(None)`
44
45 error: unnecessary closure used to substitute value for `Option::None`
46   --> $DIR/unnecessary_lazy_eval.rs:41:13
47    |
48 LL |     let _ = opt.get_or_insert_with(|| 2);
49    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `get_or_insert` instead: `opt.get_or_insert(2)`
50
51 error: unnecessary closure used to substitute value for `Option::None`
52   --> $DIR/unnecessary_lazy_eval.rs:42:13
53    |
54 LL |     let _ = opt.ok_or_else(|| 2);
55    |             ^^^^^^^^^^^^^^^^^^^^ help: Use `ok_or` instead: `opt.ok_or(2)`
56
57 error: unnecessary closure used to substitute value for `Option::None`
58   --> $DIR/unnecessary_lazy_eval.rs:43:13
59    |
60 LL |     let _ = opt.ok_or_else(|| ext_arr[0]);
61    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `ok_or` instead: `opt.ok_or(ext_arr[0])`
62
63 error: unnecessary closure used to substitute value for `Option::None`
64   --> $DIR/unnecessary_lazy_eval.rs:46:13
65    |
66 LL |     let _ = Some(10).unwrap_or_else(|| 2);
67    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `Some(10).unwrap_or(2)`
68
69 error: unnecessary closure used to substitute value for `Option::None`
70   --> $DIR/unnecessary_lazy_eval.rs:47:13
71    |
72 LL |     let _ = Some(10).and_then(|_| ext_opt);
73    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `Some(10).and(ext_opt)`
74
75 error: unnecessary closure used to substitute value for `Option::None`
76   --> $DIR/unnecessary_lazy_eval.rs:48:28
77    |
78 LL |     let _: Option<usize> = None.or_else(|| ext_opt);
79    |                            ^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `None.or(ext_opt)`
80
81 error: unnecessary closure used to substitute value for `Option::None`
82   --> $DIR/unnecessary_lazy_eval.rs:49:13
83    |
84 LL |     let _ = None.get_or_insert_with(|| 2);
85    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `get_or_insert` instead: `None.get_or_insert(2)`
86
87 error: unnecessary closure used to substitute value for `Option::None`
88   --> $DIR/unnecessary_lazy_eval.rs:50:35
89    |
90 LL |     let _: Result<usize, usize> = None.ok_or_else(|| 2);
91    |                                   ^^^^^^^^^^^^^^^^^^^^^ help: Use `ok_or` instead: `None.ok_or(2)`
92
93 error: unnecessary closure used to substitute value for `Option::None`
94   --> $DIR/unnecessary_lazy_eval.rs:51:28
95    |
96 LL |     let _: Option<usize> = None.or_else(|| None);
97    |                            ^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `None.or(None)`
98
99 error: unnecessary closure used to substitute value for `Option::None`
100   --> $DIR/unnecessary_lazy_eval.rs:54:13
101    |
102 LL |     let _ = deep.0.unwrap_or_else(|| 2);
103    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `deep.0.unwrap_or(2)`
104
105 error: unnecessary closure used to substitute value for `Option::None`
106   --> $DIR/unnecessary_lazy_eval.rs:55:13
107    |
108 LL |     let _ = deep.0.and_then(|_| ext_opt);
109    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `deep.0.and(ext_opt)`
110
111 error: unnecessary closure used to substitute value for `Option::None`
112   --> $DIR/unnecessary_lazy_eval.rs:56:13
113    |
114 LL |     let _ = deep.0.or_else(|| None);
115    |             ^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `deep.0.or(None)`
116
117 error: unnecessary closure used to substitute value for `Option::None`
118   --> $DIR/unnecessary_lazy_eval.rs:57:13
119    |
120 LL |     let _ = deep.0.get_or_insert_with(|| 2);
121    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `get_or_insert` instead: `deep.0.get_or_insert(2)`
122
123 error: unnecessary closure used to substitute value for `Option::None`
124   --> $DIR/unnecessary_lazy_eval.rs:58:13
125    |
126 LL |     let _ = deep.0.ok_or_else(|| 2);
127    |             ^^^^^^^^^^^^^^^^^^^^^^^ help: Use `ok_or` instead: `deep.0.ok_or(2)`
128
129 error: unnecessary closure used to substitute value for `Result::Err`
130   --> $DIR/unnecessary_lazy_eval.rs:84:13
131    |
132 LL |     let _ = res2.unwrap_or_else(|_| 2);
133    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `res2.unwrap_or(2)`
134
135 error: unnecessary closure used to substitute value for `Result::Err`
136   --> $DIR/unnecessary_lazy_eval.rs:85:13
137    |
138 LL |     let _ = res2.unwrap_or_else(|_| astronomers_pi);
139    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `res2.unwrap_or(astronomers_pi)`
140
141 error: unnecessary closure used to substitute value for `Result::Err`
142   --> $DIR/unnecessary_lazy_eval.rs:86:13
143    |
144 LL |     let _ = res2.unwrap_or_else(|_| ext_str.some_field);
145    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `res2.unwrap_or(ext_str.some_field)`
146
147 error: aborting due to 24 previous errors
148