mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 14:43:24 +00:00
Simplify panic_if_treat_err_as_bug avoiding allocations
This commit is contained in:
parent
7b5d9836c4
commit
28cfa9730e
@ -973,16 +973,14 @@ impl HandlerInner {
|
||||
|
||||
fn panic_if_treat_err_as_bug(&self) {
|
||||
if self.treat_err_as_bug() {
|
||||
let s = match (self.err_count(), self.flags.treat_err_as_bug.unwrap_or(0)) {
|
||||
(0, _) => return,
|
||||
(1, 1) => "aborting due to `-Z treat-err-as-bug=1`".to_string(),
|
||||
(1, _) => return,
|
||||
(count, as_bug) => format!(
|
||||
match (self.err_count(), self.flags.treat_err_as_bug.unwrap_or(0)) {
|
||||
(1, 1) => panic!("aborting due to `-Z treat-err-as-bug=1`"),
|
||||
(0, _) | (1, _) => {}
|
||||
(count, as_bug) => panic!(
|
||||
"aborting after {} errors due to `-Z treat-err-as-bug={}`",
|
||||
count, as_bug,
|
||||
),
|
||||
};
|
||||
panic!(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user