Skip to content

Commit 12404e4

Browse files
committed
Merge pull request 36 from mathstuf:formatter-name-collision
2 parents b2b3bae + 5ae5b4e commit 12404e4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

impl/src/attr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,16 @@ impl ToTokens for Display<'_> {
140140
if self.was_shorthand && fmt.value() == "{}" {
141141
let arg = args.clone().into_iter().nth(1).unwrap();
142142
tokens.extend(quote! {
143-
std::fmt::Display::fmt(#arg, formatter)
143+
std::fmt::Display::fmt(#arg, __formatter)
144144
});
145145
} else if self.was_shorthand && fmt.value() == "{:?}" {
146146
let arg = args.clone().into_iter().nth(1).unwrap();
147147
tokens.extend(quote! {
148-
std::fmt::Debug::fmt(#arg, formatter)
148+
std::fmt::Debug::fmt(#arg, __formatter)
149149
});
150150
} else {
151151
tokens.extend(quote! {
152-
write!(formatter, #fmt #args)
152+
write!(__formatter, #fmt #args)
153153
});
154154
}
155155
}

impl/src/expand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ fn impl_struct(input: Struct) -> TokenStream {
8080
let pat = fields_pat(&input.fields);
8181
quote! {
8282
impl #impl_generics std::fmt::Display for #ty #ty_generics #where_clause {
83-
fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
83+
fn fmt(&self, __formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8484
#[allow(unused_variables)]
8585
let Self #pat = self;
8686
#display
@@ -230,7 +230,7 @@ fn impl_enum(input: Enum) -> TokenStream {
230230
});
231231
Some(quote! {
232232
impl #impl_generics std::fmt::Display for #ty #ty_generics #where_clause {
233-
fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
233+
fn fmt(&self, __formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
234234
#[allow(unused_variables)]
235235
match #void_deref self {
236236
#(#arms,)*

0 commit comments

Comments
 (0)