Skip to content

Commit

Permalink
Remove unneeded fn peek prior to peek_signature
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 23, 2023
1 parent 2fea56f commit 0ab438a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ pub(crate) mod parsing {
let vis: Visibility = ahead.parse()?;

let lookahead = ahead.lookahead1();
let mut item = if lookahead.peek(Token![fn]) || peek_signature(&ahead) {
let mut item = if peek_signature(&ahead) {
let vis: Visibility = input.parse()?;
let sig: Signature = input.parse()?;
if input.peek(Token![;]) {
Expand Down Expand Up @@ -1729,7 +1729,7 @@ pub(crate) mod parsing {
let vis: Visibility = ahead.parse()?;

let lookahead = ahead.lookahead1();
let mut item = if lookahead.peek(Token![fn]) || peek_signature(&ahead) {
let mut item = if peek_signature(&ahead) {
let vis: Visibility = input.parse()?;
let sig: Signature = input.parse()?;
if input.peek(token::Brace) {
Expand Down Expand Up @@ -2184,7 +2184,7 @@ pub(crate) mod parsing {
let ahead = input.fork();

let lookahead = ahead.lookahead1();
let mut item = if lookahead.peek(Token![fn]) || peek_signature(&ahead) {
let mut item = if peek_signature(&ahead) {
input.parse().map(TraitItem::Fn)
} else if lookahead.peek(Token![const]) {
ahead.parse::<Token![const]>()?;
Expand Down Expand Up @@ -2511,7 +2511,7 @@ pub(crate) mod parsing {
None
};

let mut item = if lookahead.peek(Token![fn]) || peek_signature(&ahead) {
let mut item = if peek_signature(&ahead) {
input.parse().map(ImplItem::Fn)
} else if lookahead.peek(Token![const]) {
let const_token: Token![const] = ahead.parse()?;
Expand Down

0 comments on commit 0ab438a

Please sign in to comment.