Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 224d45c

Browse files
committedJun 11, 2024
Use unnamed lifetimes for [..]Payload impl blocks.
1 parent cf984e0 commit 224d45c

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed
 

‎std/src/panicking.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -597,11 +597,7 @@ pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
597597
string: Option<String>,
598598
}
599599

600-
impl<'a> FormatStringPayload<'a> {
601-
fn new(inner: &'a fmt::Arguments<'a>) -> Self {
602-
Self { inner, string: None }
603-
}
604-
600+
impl FormatStringPayload<'_> {
605601
fn fill(&mut self) -> &mut String {
606602
use crate::fmt::Write;
607603

@@ -615,7 +611,7 @@ pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
615611
}
616612
}
617613

618-
unsafe impl<'a> PanicPayload for FormatStringPayload<'a> {
614+
unsafe impl PanicPayload for FormatStringPayload<'_> {
619615
fn take_box(&mut self) -> *mut (dyn Any + Send) {
620616
// We do two allocations here, unfortunately. But (a) they're required with the current
621617
// scheme, and (b) we don't handle panic + OOM properly anyway (see comment in
@@ -654,7 +650,7 @@ pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
654650
);
655651
} else {
656652
rust_panic_with_hook(
657-
&mut FormatStringPayload::new(&msg),
653+
&mut FormatStringPayload { inner: &msg, string: None },
658654
Some(msg),
659655
loc,
660656
info.can_unwind(),

0 commit comments

Comments
 (0)
Failed to load comments.