Skip to content

Commit 678ac08

Browse files
Add or_fun_call fix
1 parent d3a6d3a commit 678ac08

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

tests/ui/or_fun_call.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn or_fun_call() {
6262
map.entry(42).or_insert_with(String::new);
6363

6464
let mut btree = BTreeMap::<u64, String>::new();
65-
btree.entry(42).or_insert_with(String::new);
65+
btree.entry(42).or_insert(String::new());
6666

6767
let stringy = Some(String::from(""));
6868
let _ = stringy.unwrap_or_else(|| "".to_owned());

tests/ui/or_fun_call.stderr

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ error: use of `or_insert` followed by a function call
6666
LL | map.entry(42).or_insert(String::new());
6767
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
6868

69-
error: use of `or_insert` followed by a function call
70-
--> $DIR/or_fun_call.rs:65:21
71-
|
72-
LL | btree.entry(42).or_insert(String::new());
73-
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
74-
7569
error: use of `unwrap_or` followed by a function call
7670
--> $DIR/or_fun_call.rs:68:21
7771
|
@@ -90,5 +84,5 @@ error: use of `or` followed by a function call
9084
LL | .or(Some(Bar(b, Duration::from_secs(2))));
9185
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_else(|| Some(Bar(b, Duration::from_secs(2))))`
9286

93-
error: aborting due to 15 previous errors
87+
error: aborting due to 14 previous errors
9488

0 commit comments

Comments
 (0)