Skip to content

Commit

Permalink
Merge pull request #825 from dtolnay/extern
Browse files Browse the repository at this point in the history
Remove parsing of extern:: paths
  • Loading branch information
dtolnay committed May 25, 2020
2 parents 5396e55 + 80c6889 commit ff20ea1
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/discouraged.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ pub trait Speculative {
/// || input.peek(Token![self])
/// || input.peek(Token![Self])
/// || input.peek(Token![crate])
/// || input.peek(Token![extern])
/// {
/// let ident = input.call(Ident::parse_any)?;
/// return Ok(PathSegment::from(ident));
Expand Down
2 changes: 0 additions & 2 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1717,7 +1717,6 @@ pub(crate) mod parsing {
|| input.peek(Token![self])
|| input.peek(Token![Self])
|| input.peek(Token![super])
|| input.peek(Token![extern])
|| input.peek(Token![crate])
{
path_or_macro_or_struct(input, allow_struct)
Expand Down Expand Up @@ -1789,7 +1788,6 @@ pub(crate) mod parsing {
|| input.peek(Token![self])
|| input.peek(Token![Self])
|| input.peek(Token![super])
|| input.peek(Token![extern])
|| input.peek(Token![crate])
{
input.parse().map(Expr::Path)
Expand Down
5 changes: 0 additions & 5 deletions src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,6 @@ pub mod parsing {
&& (lookahead.peek(Ident)
|| lookahead.peek(Token![self])
|| lookahead.peek(Token![super])
|| lookahead.peek(Token![extern])
|| lookahead.peek(Token![crate])
|| lookahead.peek(Token![::]))
{
Expand Down Expand Up @@ -1494,7 +1493,6 @@ pub mod parsing {
|| lookahead.peek(Token![self])
|| lookahead.peek(Token![super])
|| lookahead.peek(Token![crate])
|| lookahead.peek(Token![extern])
{
let ident = input.call(Ident::parse_any)?;
if input.peek(Token![::]) {
Expand Down Expand Up @@ -1929,7 +1927,6 @@ pub mod parsing {
&& (lookahead.peek(Ident)
|| lookahead.peek(Token![self])
|| lookahead.peek(Token![super])
|| lookahead.peek(Token![extern])
|| lookahead.peek(Token![crate])
|| lookahead.peek(Token![::]))
{
Expand Down Expand Up @@ -2393,7 +2390,6 @@ pub mod parsing {
} else if lookahead.peek(Ident)
|| lookahead.peek(Token![self])
|| lookahead.peek(Token![super])
|| lookahead.peek(Token![extern])
|| lookahead.peek(Token![crate])
|| lookahead.peek(Token![::])
{
Expand Down Expand Up @@ -2694,7 +2690,6 @@ pub mod parsing {
&& (lookahead.peek(Ident)
|| lookahead.peek(Token![self])
|| lookahead.peek(Token![super])
|| lookahead.peek(Token![extern])
|| lookahead.peek(Token![crate])
|| lookahead.peek(Token![::]))
{
Expand Down
2 changes: 0 additions & 2 deletions src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ pub mod parsing {
|| lookahead.peek(Token![<])
|| input.peek(Token![Self])
|| input.peek(Token![super])
|| input.peek(Token![extern])
|| input.peek(Token![crate])
{
pat_path_or_macro_or_struct_or_range(input)
Expand Down Expand Up @@ -746,7 +745,6 @@ pub mod parsing {
|| lookahead.peek(Token![self])
|| lookahead.peek(Token![Self])
|| lookahead.peek(Token![super])
|| lookahead.peek(Token![extern])
|| lookahead.peek(Token![crate])
{
Expr::Path(input.parse()?)
Expand Down
7 changes: 1 addition & 6 deletions src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,7 @@ pub mod parsing {

impl PathSegment {
fn parse_helper(input: ParseStream, expr_style: bool) -> Result<Self> {
if input.peek(Token![super])
|| input.peek(Token![self])
|| input.peek(Token![crate])
|| input.peek(Token![extern])
{
if input.peek(Token![super]) || input.peek(Token![self]) || input.peek(Token![crate]) {
let ident = input.call(Ident::parse_any)?;
return Ok(PathSegment::from(ident));
}
Expand Down Expand Up @@ -400,7 +396,6 @@ pub mod parsing {
&& !input.peek(Token![self])
&& !input.peek(Token![Self])
&& !input.peek(Token![crate])
&& !input.peek(Token![extern])
{
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub mod parsing {
stmt_local(input, attrs).map(Stmt::Local)
} else if input.peek(Token![pub])
|| input.peek(Token![crate]) && !input.peek2(Token![::])
|| input.peek(Token![extern]) && !input.peek2(Token![::])
|| input.peek(Token![extern])
|| input.peek(Token![use])
|| input.peek(Token![static]) && (input.peek2(Token![mut]) || input.peek2(Ident))
|| input.peek(Token![const])
Expand Down
3 changes: 1 addition & 2 deletions src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ pub mod parsing {
}))
} else if lookahead.peek(Token![fn])
|| lookahead.peek(Token![unsafe])
|| lookahead.peek(Token![extern]) && !input.peek2(Token![::])
|| lookahead.peek(Token![extern])
{
let allow_mut_self = true;
if let Some(mut bare_fn) = parse_bare_fn(input, allow_mut_self)? {
Expand All @@ -568,7 +568,6 @@ pub mod parsing {
|| input.peek(Token![self])
|| input.peek(Token![Self])
|| input.peek(Token![crate])
|| input.peek(Token![extern])
|| lookahead.peek(Token![::])
|| lookahead.peek(Token![<])
{
Expand Down

0 comments on commit ff20ea1

Please sign in to comment.