File tree 2 files changed +8
-2
lines changed 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ fn or_fun_call() {
98
98
99
99
let opt = Some(1);
100
100
let hello = "Hello";
101
- let _ = opt.ok_or( format!("{} world.", hello));
101
+ let _ = opt.ok_or_else(|| format!("{} world.", hello));
102
102
103
103
// index
104
104
let map = HashMap::<u64, u64>::new();
Original file line number Diff line number Diff line change @@ -100,6 +100,12 @@ error: use of `unwrap_or` to construct default value
100
100
LL | let _ = stringy.unwrap_or(String::new());
101
101
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
102
102
103
+ error: use of `ok_or` followed by a function call
104
+ --> tests/ui/or_fun_call.rs:101:17
105
+ |
106
+ LL | let _ = opt.ok_or(format!("{} world.", hello));
107
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ok_or_else(|| format!("{} world.", hello))`
108
+
103
109
error: use of `unwrap_or` followed by a function call
104
110
--> tests/ui/or_fun_call.rs:105:21
105
111
|
@@ -190,5 +196,5 @@ error: use of `unwrap_or_else` to construct default value
190
196
LL | let _ = stringy.unwrap_or_else(String::new);
191
197
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
192
198
193
- error: aborting due to 31 previous errors
199
+ error: aborting due to 32 previous errors
194
200
You can’t perform that action at this time.
0 commit comments