This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 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() {
9898
9999 let opt = Some(1);
100100 let hello = "Hello";
101- let _ = opt.ok_or( format!("{} world.", hello));
101+ let _ = opt.ok_or_else(|| format!("{} world.", hello));
102102
103103 // index
104104 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
100100LL | let _ = stringy.unwrap_or(String::new());
101101 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
102102
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+
103109error: use of `unwrap_or` followed by a function call
104110 --> tests/ui/or_fun_call.rs:105:21
105111 |
@@ -190,5 +196,5 @@ error: use of `unwrap_or_else` to construct default value
190196LL | let _ = stringy.unwrap_or_else(String::new);
191197 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
192198
193- error: aborting due to 31 previous errors
199+ error: aborting due to 32 previous errors
194200
You can’t perform that action at this time.
0 commit comments