Replace old Ident::parse_any
diff --git a/src/data.rs b/src/data.rs
index d755d83..242dc7f 100644
--- a/src/data.rs
+++ b/src/data.rs
@@ -286,7 +286,7 @@
pub_token: pub_token,
paren_token: parenthesized!(content in input),
in_token: None,
- path: Box::new(Path::from(content.parse_synom(Ident::parse_any)?)),
+ path: Box::new(Path::from(content.call(Ident::parse_any)?)),
}));
} else if content.peek(Token![in]) {
return Ok(Visibility::Restricted(VisRestricted {
diff --git a/src/expr.rs b/src/expr.rs
index f53c916..d03d63f 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -2645,7 +2645,7 @@
mutability: input.parse()?,
ident: {
let ident = if input.peek(Ident) || input.peek(Token![self]) {
- input.call(Ident::parse_any2)?
+ input.call(Ident::parse_any)?
} else {
return Err(input.error("expected identifier or `self`"));
};
diff --git a/src/item.rs b/src/item.rs
index 078c737..325710a 100644
--- a/src/item.rs
+++ b/src/item.rs
@@ -947,7 +947,7 @@
|| lookahead.peek(Token![crate])
|| lookahead.peek(Token![extern])
{
- let ident = input.call(Ident::parse_any2)?;
+ let ident = input.call(Ident::parse_any)?;
if input.peek(Token![::]) {
Ok(UseTree::Path(UsePath {
ident: ident,
diff --git a/src/lifetime.rs b/src/lifetime.rs
index c8101eb..6a039c6 100644
--- a/src/lifetime.rs
+++ b/src/lifetime.rs
@@ -130,7 +130,7 @@
return Err(Error::new(err.span(), "expected lifetime"));
}
},
- ident: input.call(Ident::parse_any2)?,
+ ident: input.call(Ident::parse_any)?,
})
}
}
diff --git a/src/path.rs b/src/path.rs
index 6e68000..6baf35a 100644
--- a/src/path.rs
+++ b/src/path.rs
@@ -316,7 +316,7 @@
|| input.peek(Token![crate])
|| input.peek(Token![extern])
{
- let ident = input.parse_synom(Ident::parse_any)?;
+ let ident = input.call(Ident::parse_any)?;
return Ok(PathSegment::from(ident));
}
@@ -360,7 +360,7 @@
{
break;
}
- let ident = Ident::parse_any2(input)?;
+ let ident = Ident::parse_any(input)?;
segments.push_value(PathSegment::from(ident));
if !input.peek(Token![::]) {
break;
diff --git a/src/synom.rs b/src/synom.rs
index 0c4c052..d5f1684 100644
--- a/src/synom.rs
+++ b/src/synom.rs
@@ -161,7 +161,6 @@
use proc_macro;
use proc_macro2::{self, Delimiter, Group, Literal, Punct, Span, TokenStream, TokenTree};
-use error::parse_error;
pub use error::{Error, PResult};
use buffer::{Cursor, TokenBuffer};
@@ -330,7 +329,6 @@
///
/// *This module is available if Syn is built with the `"parsing"` feature.*
pub mod ext {
- use super::*;
use proc_macro2::Ident;
use parse::{ParseStream, Result};
@@ -368,17 +366,11 @@
/// #
/// # fn main() {}
/// ```
- fn parse_any(input: Cursor) -> PResult<Self>;
-
- fn parse_any2(input: ParseStream) -> Result<Self>;
+ fn parse_any(input: ParseStream) -> Result<Self>;
}
impl IdentExt for Ident {
- fn parse_any(input: Cursor) -> PResult<Self> {
- input.ident().map_or_else(parse_error, Ok)
- }
-
- fn parse_any2(input: ParseStream) -> Result<Self> {
+ fn parse_any(input: ParseStream) -> Result<Self> {
input.step_cursor(|cursor| match cursor.ident() {
Some((ident, rest)) => Ok((ident, rest)),
None => Err(cursor.error("expected ident")),