diff options
| author | Michael Wright <mikerite@lavabit.com> | 2019-03-06 07:00:05 +0200 |
|---|---|---|
| committer | Michael Wright <mikerite@lavabit.com> | 2019-03-06 07:00:05 +0200 |
| commit | 464ed58861e154f0ed462a3a1fc4c55a17823a6b (patch) | |
| tree | 0f8e5270400b8a9b73f9afac9807ba2554d83e87 | |
| parent | a8f61e70a8c1c438658d0c30080fc3ce3be6c2df (diff) | |
| download | rust-464ed58861e154f0ed462a3a1fc4c55a17823a6b.tar.gz rust-464ed58861e154f0ed462a3a1fc4c55a17823a6b.zip | |
Ensure `expect_fun_call` bad suggestion is fixed
Closes #3839
| -rw-r--r-- | tests/ui/expect_fun_call.fixed | 3 | ||||
| -rw-r--r-- | tests/ui/expect_fun_call.rs | 3 | ||||
| -rw-r--r-- | tests/ui/expect_fun_call.stderr | 8 |
3 files changed, 13 insertions, 1 deletions
diff --git a/tests/ui/expect_fun_call.fixed b/tests/ui/expect_fun_call.fixed index 1f74f6b8cf1..e111ee3dfed 100644 --- a/tests/ui/expect_fun_call.fixed +++ b/tests/ui/expect_fun_call.fixed @@ -81,4 +81,7 @@ fn main() { Some("foo").unwrap_or_else(|| { panic!(get_static_str()) }); Some("foo").unwrap_or_else(|| { panic!(get_non_static_str(&0).to_string()) }); } + + //Issue #3839 + Some(true).unwrap_or_else(|| panic!("key {}, {}", 1, 2)); } diff --git a/tests/ui/expect_fun_call.rs b/tests/ui/expect_fun_call.rs index 2d8b4925f35..891ec883120 100644 --- a/tests/ui/expect_fun_call.rs +++ b/tests/ui/expect_fun_call.rs @@ -81,4 +81,7 @@ fn main() { Some("foo").expect(get_static_str()); Some("foo").expect(get_non_static_str(&0)); } + + //Issue #3839 + Some(true).expect(&format!("key {}, {}", 1, 2)); } diff --git a/tests/ui/expect_fun_call.stderr b/tests/ui/expect_fun_call.stderr index 900e251d964..bb16fabd973 100644 --- a/tests/ui/expect_fun_call.stderr +++ b/tests/ui/expect_fun_call.stderr @@ -60,5 +60,11 @@ error: use of `expect` followed by a function call LL | Some("foo").expect(get_non_static_str(&0)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!(get_non_static_str(&0).to_string()) })` -error: aborting due to 10 previous errors +error: use of `expect` followed by a function call + --> $DIR/expect_fun_call.rs:86:16 + | +LL | Some(true).expect(&format!("key {}, {}", 1, 2)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("key {}, {}", 1, 2))` + +error: aborting due to 11 previous errors |
