about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2023-03-15 07:10:59 +0800
committeryukang <moorekang@gmail.com>2023-05-01 16:15:17 +0800
commitf54489978d478797108218fda90e1c929e657937 (patch)
tree9c380cc77c7d1b18161a524547e893d55396601f /compiler/rustc_parse/src
parenta4453c20cae5e72073d3cb6180132de2f371d2de (diff)
downloadrust-f54489978d478797108218fda90e1c929e657937.tar.gz
rust-f54489978d478797108218fda90e1c929e657937.zip
fix tests
Diffstat (limited to 'compiler/rustc_parse/src')
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs1
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs15
-rw-r--r--compiler/rustc_parse/src/parser/mod.rs7
-rw-r--r--compiler/rustc_parse/src/parser/path.rs2
4 files changed, 5 insertions, 20 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index aad7d21e1b4..da419f06537 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -238,7 +238,6 @@ impl<'a> DerefMut for SnapshotParser<'a> {
 
 impl<'a> Parser<'a> {
     #[rustc_lint_diagnostics]
-    #[track_caller]
     pub fn struct_span_err<S: Into<MultiSpan>>(
         &self,
         sp: S,
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 7c55ac9cce2..02db4b095dc 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -294,17 +294,6 @@ impl<'a> Parser<'a> {
                 continue;
             }
 
-            // Special cases:
-            if op.node == AssocOp::As {
-                lhs = self.parse_assoc_op_cast(lhs, lhs_span, ExprKind::Cast)?;
-                continue;
-            } else if op.node == AssocOp::DotDot || op.node == AssocOp::DotDotEq {
-                // If we didn't have to handle `x..`/`x..=`, it would be pretty easy to
-                // generalise it to the Fixity::None code.
-                lhs = self.parse_expr_range(prec, lhs, op.node, cur_op_span)?;
-                break;
-            }
-
             let op = op.node;
             // Special cases:
             if op == AssocOp::As {
@@ -619,9 +608,7 @@ impl<'a> Parser<'a> {
             token::Ident(..) if this.may_recover() && this.is_mistaken_not_ident_negation() => {
                 make_it!(this, attrs, |this, _| this.recover_not_expr(lo))
             }
-            _ => {
-                return this.parse_expr_dot_or_call(Some(attrs));
-            }
+            _ => return this.parse_expr_dot_or_call(Some(attrs)),
         }
     }
 
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs
index 8cf0f95d90e..b294e13402a 100644
--- a/compiler/rustc_parse/src/parser/mod.rs
+++ b/compiler/rustc_parse/src/parser/mod.rs
@@ -828,11 +828,10 @@ impl<'a> Parser<'a> {
     }
 
     fn expect_any_with_type(&mut self, kets: &[&TokenKind], expect: TokenExpectType) -> bool {
-        let res = kets.iter().any(|k| match expect {
+        kets.iter().any(|k| match expect {
             TokenExpectType::Expect => self.check(k),
             TokenExpectType::NoExpect => self.token == **k,
-        });
-        res
+        })
     }
 
     fn parse_seq_to_before_tokens<T>(
@@ -960,6 +959,7 @@ impl<'a> Parser<'a> {
             let t = f(self)?;
             v.push(t);
         }
+
         Ok((v, trailing, recovered))
     }
 
@@ -1045,7 +1045,6 @@ impl<'a> Parser<'a> {
         f: impl FnMut(&mut Parser<'a>) -> PResult<'a, T>,
     ) -> PResult<'a, (ThinVec<T>, bool /* trailing */)> {
         let (val, trailing, recovered) = self.parse_seq_to_before_end(ket, sep, f)?;
-
         if !recovered {
             self.eat(ket);
         }
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs
index 950efc2a9fc..9a863a8eef7 100644
--- a/compiler/rustc_parse/src/parser/path.rs
+++ b/compiler/rustc_parse/src/parser/path.rs
@@ -17,7 +17,7 @@ use thin_vec::ThinVec;
 use tracing::debug;
 
 /// Specifies how to parse a path.
-#[derive(Copy, Clone, PartialEq, Debug)]
+#[derive(Copy, Clone, PartialEq)]
 pub enum PathStyle {
     /// In some contexts, notably in expressions, paths with generic arguments are ambiguous
     /// with something else. For example, in expressions `segment < ....` can be interpreted