Skip to content

Commit

Permalink
Add or_fun_call fix
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancisMurillo committed Oct 18, 2020
1 parent d3a6d3a commit 678ac08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 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 @@ -62,7 +62,7 @@ fn or_fun_call() {
map.entry(42).or_insert_with(String::new);

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

let stringy = Some(String::from(""));
let _ = stringy.unwrap_or_else(|| "".to_owned());
Expand Down
8 changes: 1 addition & 7 deletions tests/ui/or_fun_call.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ error: use of `or_insert` followed by a function call
LL | map.entry(42).or_insert(String::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`

error: use of `or_insert` followed by a function call
--> $DIR/or_fun_call.rs:65:21
|
LL | btree.entry(42).or_insert(String::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`

error: use of `unwrap_or` followed by a function call
--> $DIR/or_fun_call.rs:68:21
|
Expand All @@ -90,5 +84,5 @@ error: use of `or` followed by a function call
LL | .or(Some(Bar(b, Duration::from_secs(2))));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_else(|| Some(Bar(b, Duration::from_secs(2))))`

error: aborting due to 15 previous errors
error: aborting due to 14 previous errors

0 comments on commit 678ac08

Please sign in to comment.