Skip to content

Commit

Permalink
Rollup merge of rust-lang#127355 - aceArt-GmbH:126475, r=oli-obk
Browse files Browse the repository at this point in the history
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
  • Loading branch information
matthiaskrgr authored Jul 8, 2024
2 parents e82cfdc + e0f32e0 commit a988389
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/ui/or_fun_call.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fn or_fun_call() {

let opt = Some(1);
let hello = "Hello";
let _ = opt.ok_or(format!("{} world.", hello));
let _ = opt.ok_or_else(|| format!("{} world.", hello));

// index
let map = HashMap::<u64, u64>::new();
Expand Down
8 changes: 7 additions & 1 deletion tests/ui/or_fun_call.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ error: use of `unwrap_or` to construct default value
LL | let _ = stringy.unwrap_or(String::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `ok_or` followed by a function call
--> tests/ui/or_fun_call.rs:101:17
|
LL | let _ = opt.ok_or(format!("{} world.", hello));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ok_or_else(|| format!("{} world.", hello))`

error: use of `unwrap_or` followed by a function call
--> tests/ui/or_fun_call.rs:105:21
|
Expand Down Expand Up @@ -190,5 +196,5 @@ error: use of `unwrap_or_else` to construct default value
LL | let _ = stringy.unwrap_or_else(String::new);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: aborting due to 31 previous errors
error: aborting due to 32 previous errors

0 comments on commit a988389

Please sign in to comment.