diff --git a/src/lookahead.rs b/src/lookahead.rs index 2ca147147..75e3a658a 100644 --- a/src/lookahead.rs +++ b/src/lookahead.rs @@ -3,7 +3,7 @@ use crate::error::{self, Error}; use crate::sealed::lookahead::Sealed; use crate::span::IntoSpans; use crate::token::Token; -use proc_macro2::{Delimiter, Span}; +use proc_macro2::Span; use std::cell::RefCell; /// Support for checking the next token in a stream to decide how to parse. @@ -162,8 +162,4 @@ impl IntoSpans for TokenMarker { } } -pub(crate) fn is_delimiter(cursor: Cursor, delimiter: Delimiter) -> bool { - cursor.group(delimiter).is_some() -} - impl T, T: Token> Sealed for F {} diff --git a/src/token.rs b/src/token.rs index e04f10574..a39a1af67 100644 --- a/src/token.rs +++ b/src/token.rs @@ -100,8 +100,6 @@ use crate::lifetime::Lifetime; #[cfg(feature = "parsing")] use crate::lit::{Lit, LitBool, LitByte, LitByteStr, LitChar, LitFloat, LitInt, LitStr}; #[cfg(feature = "parsing")] -use crate::lookahead; -#[cfg(feature = "parsing")] use crate::parse::{Parse, ParseStream}; use crate::span::IntoSpans; use proc_macro2::extra::DelimSpan; @@ -692,7 +690,7 @@ impl private::Sealed for Group {} #[cfg(feature = "parsing")] impl Token for Paren { fn peek(cursor: Cursor) -> bool { - lookahead::is_delimiter(cursor, Delimiter::Parenthesis) + cursor.group(Delimiter::Parenthesis).is_some() } fn display() -> &'static str { @@ -703,7 +701,7 @@ impl Token for Paren { #[cfg(feature = "parsing")] impl Token for Brace { fn peek(cursor: Cursor) -> bool { - lookahead::is_delimiter(cursor, Delimiter::Brace) + cursor.group(Delimiter::Brace).is_some() } fn display() -> &'static str { @@ -714,7 +712,7 @@ impl Token for Brace { #[cfg(feature = "parsing")] impl Token for Bracket { fn peek(cursor: Cursor) -> bool { - lookahead::is_delimiter(cursor, Delimiter::Bracket) + cursor.group(Delimiter::Bracket).is_some() } fn display() -> &'static str { @@ -725,7 +723,7 @@ impl Token for Bracket { #[cfg(feature = "parsing")] impl Token for Group { fn peek(cursor: Cursor) -> bool { - lookahead::is_delimiter(cursor, Delimiter::None) + cursor.group(Delimiter::None).is_some() } fn display() -> &'static str {