Skip to content

Commit a988389

Browse files
authored
Rollup merge of rust-lang#127355 - aceArt-GmbH:126475, r=oli-obk
Mark format! with must_use hint Uses unstable feature rust-lang#94745 Part of rust-lang#126475 First contribution to rust, please let me know if the blessing of tests is correct Thanks `@bjorn3` for the help
2 parents e82cfdc + e0f32e0 commit a988389

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/ui/or_fun_call.fixed

+1-1
Original file line numberDiff line numberDiff 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();

tests/ui/or_fun_call.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ error: use of `unwrap_or` to construct default value
100100
LL | 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+
103109
error: 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
190196
LL | 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

0 commit comments

Comments
 (0)