From 678ac081a50bf6122b0423f9ee4a01c175e59cf1 Mon Sep 17 00:00:00 2001 From: Francis Murillo Date: Sun, 18 Oct 2020 09:39:50 +0800 Subject: [PATCH] Add or_fun_call fix --- tests/ui/or_fun_call.fixed | 2 +- tests/ui/or_fun_call.stderr | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/ui/or_fun_call.fixed b/tests/ui/or_fun_call.fixed index 2045ffdb5f09..a6378eb14aa9 100644 --- a/tests/ui/or_fun_call.fixed +++ b/tests/ui/or_fun_call.fixed @@ -62,7 +62,7 @@ fn or_fun_call() { map.entry(42).or_insert_with(String::new); let mut btree = BTreeMap::::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()); diff --git a/tests/ui/or_fun_call.stderr b/tests/ui/or_fun_call.stderr index bc5978b538f1..a288dde4b6b5 100644 --- a/tests/ui/or_fun_call.stderr +++ b/tests/ui/or_fun_call.stderr @@ -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 | @@ -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