Skip to content

Commit

Permalink
Auto merge of #3846 - mikerite:fix-3839, r=phansch
Browse files Browse the repository at this point in the history
Ensure `expect_fun_call` bad suggestion is fixed

Closes #3839
  • Loading branch information
bors committed Mar 6, 2019
2 parents a8f61e7 + 464ed58 commit 400ee06
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions tests/ui/expect_fun_call.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
3 changes: 3 additions & 0 deletions tests/ui/expect_fun_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
8 changes: 7 additions & 1 deletion tests/ui/expect_fun_call.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 400ee06

Please sign in to comment.