Skip to content

Commit ca211ea

Browse files
committed
Panic directly in Arguments::new* instead of recursing
1 parent d4c86cf commit ca211ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/core/src/fmt/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ impl<'a> Arguments<'a> {
320320
#[rustc_const_unstable(feature = "const_fmt_arguments_new", issue = "none")]
321321
pub const fn new_const(pieces: &'a [&'static str]) -> Self {
322322
if pieces.len() > 1 {
323-
panic!("invalid args");
323+
crate::panicking::panic("invalid args");
324324
}
325325
Arguments { pieces, fmt: None, args: &[] }
326326
}
@@ -330,7 +330,7 @@ impl<'a> Arguments<'a> {
330330
#[inline]
331331
pub fn new_v1(pieces: &'a [&'static str], args: &'a [rt::Argument<'a>]) -> Arguments<'a> {
332332
if pieces.len() < args.len() || pieces.len() > args.len() + 1 {
333-
panic!("invalid args");
333+
crate::panicking::panic("invalid args");
334334
}
335335
Arguments { pieces, fmt: None, args }
336336
}

0 commit comments

Comments
 (0)