Rollup merge of #81645 - m-ou-se:panic-lint, r=estebank,flip1995
Add lint for `panic!(123)` which is not accepted in Rust 2021. This extends the `panic_fmt` lint to warn for all cases where the first argument cannot be interpreted as a format string, as will happen in Rust 2021. It suggests to add `"{}",` to format the message as a string. In the case of `std::panic!()`, it also suggests the recently stabilized `std::panic::panic_any()` function as an alternative. It renames the lint to `non_fmt_panic` to match the lint naming guidelines.  This is part of #80162. r? ```@estebank```
This commit is contained in:
commit
87b269ab66
32 changed files with 396 additions and 258 deletions
|
@ -28,7 +28,7 @@ pub trait ExpectOne<A: Array> {
|
|||
|
||||
impl<A: Array> ExpectOne<A> for SmallVec<A> {
|
||||
fn expect_one(self, err: &'static str) -> A::Item {
|
||||
assert!(self.len() == 1, err);
|
||||
assert!(self.len() == 1, "{}", err);
|
||||
self.into_iter().next().unwrap()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue