mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
parent
a8f61e70a8
commit
464ed58861
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user