diff --git a/compiler/ast/asdl_rs.py b/compiler/ast/asdl_rs.py index 046146a940..7013f3580c 100755 --- a/compiler/ast/asdl_rs.py +++ b/compiler/ast/asdl_rs.py @@ -711,24 +711,6 @@ def write_ast_def(mod, typeinfo, f): } } - impl std::ops::Deref for Located { - type Target = T; - - fn deref(&self) -> &Self::Target { - &self.node - } - - pub const fn start(&self) -> Location { - self.location - } - - /// Returns the node's [`end_location`](Located::end_location) or [`location`](Located::start) if - /// [`end_location`](Located::end_location) is `None`. - pub fn end(&self) -> Location { - self.end_location.unwrap_or(self.location) - } - } - impl std::ops::Deref for Located { type Target = T; diff --git a/compiler/parser/python.lalrpop b/compiler/parser/python.lalrpop index 0b18f5c2e3..9f03853661 100644 --- a/compiler/parser/python.lalrpop +++ b/compiler/parser/python.lalrpop @@ -519,7 +519,7 @@ ClosedPattern: ast::Pattern = { SequencePattern: ast::PatternKind = { // A single-item tuple is a special case: it's a group pattern, _not_ a sequence pattern. - "(" ")" => pattern.into_node(), + "(" ")" => pattern.node, "(" ")" => ast::PatternKind::MatchSequence { patterns: vec![], }, @@ -1554,7 +1554,7 @@ Atom: ast::Expr = { }, "(" >> ",")?> )*> ")" =>? { if left.is_none() && right.is_empty() && trailing_comma.is_none() { - if matches!(mid.node(), ast::ExprKind::Starred { .. }) { + if matches!(mid.node, ast::ExprKind::Starred { .. }) { Err(LexicalError{ error: LexicalErrorType::OtherError("cannot use starred expression here".to_string()), location: mid.start(), diff --git a/compiler/parser/src/function.rs b/compiler/parser/src/function.rs index 1bb0016d50..ea66938a7d 100644 --- a/compiler/parser/src/function.rs +++ b/compiler/parser/src/function.rs @@ -144,7 +144,7 @@ pub(crate) fn parse_args(func_args: Vec) -> Result bool { - matches!(exp.node(), ast::ExprKind::Starred { .. }) + matches!(exp.node, ast::ExprKind::Starred { .. }) } #[cfg(test)]