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