Skip to content

Commit

Permalink
fix: sanitize Debug impls against other possible traits with fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladislav authored and loyd committed Dec 20, 2024
1 parent b376cb6 commit 2f20f47
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions elfo-macros-impl/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ fn gen_impl_debug(input: &DeriveInput) -> TokenStream {
};

let propagate_fmt = if let Some(ident) = field.ident.as_ref() {
quote! { self.#ident.fmt(f) }
quote! { ::std::fmt::Debug::fmt(&self.#ident, f) }
} else {
quote! { self.0.fmt(f) }
quote! { ::std::fmt::Debug::fmt(&self.0, f) }
};

quote! {
Expand Down Expand Up @@ -243,7 +243,7 @@ pub fn message_impl(
impl ::std::fmt::Debug for ElfoResponseWrapper {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
self.0.fmt(f)
::std::fmt::Debug::fmt(&self.0, f)
}
}

Expand Down

0 comments on commit 2f20f47

Please sign in to comment.