Skip to content

Commit

Permalink
Fix duplicated name of mut self bare fn arg
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 22, 2023
1 parent 7840102 commit 8ae37b7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ pub(crate) mod parsing {
}

let mut has_self = false;
let name = if (input.peek(Ident) || input.peek(Token![_]) || {
let mut name = if (input.peek(Ident) || input.peek(Token![_]) || {
has_self = allow_self && input.peek(Token![self]);
has_self
}) && input.peek2(Token![:])
Expand Down Expand Up @@ -945,7 +945,10 @@ pub(crate) mod parsing {

let ty = match ty {
Some(ty) if !has_mut_self => ty,
_ => Type::Verbatim(verbatim::between(begin, input)),
_ => {
name = None;
Type::Verbatim(verbatim::between(begin, input))
}
};

Ok(BareFnArg { attrs, name, ty })
Expand Down

0 comments on commit 8ae37b7

Please sign in to comment.