about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/path.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-08-15 09:58:38 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2022-08-15 13:29:28 +1000
commit2ef04795681837153df7613192305a2ddbf13497 (patch)
tree63ba7232dcbada3c9e175f7083118f3cba0e1748 /compiler/rustc_parse/src/parser/path.rs
parent1e8497351d7cb15eddd9db2f88866294bab27a21 (diff)
downloadrust-2ef04795681837153df7613192305a2ddbf13497.tar.gz
rust-2ef04795681837153df7613192305a2ddbf13497.zip
Simplify attribute handling in `parse_bottom_expr`.
`Parser::parse_bottom_expr` currently constructs an empty `attrs` and
then passes it to a large number of other functions. This makes the code
harder to read than it should be, because it's not clear that many
`attrs` arguments are always empty.

This commit removes `attrs` and the passing, simplifying a lot of
functions. The commit also renames `Parser::mk_expr` (which takes an
`attrs` argument) as `mk_expr_with_attrs`, and introduces a new
`mk_expr` which creates an expression with no attributes, which is the
more common case.
Diffstat (limited to 'compiler/rustc_parse/src/parser/path.rs')
-rw-r--r--compiler/rustc_parse/src/parser/path.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs
index 5cf1758c31f..8332c171a9c 100644
--- a/compiler/rustc_parse/src/parser/path.rs
+++ b/compiler/rustc_parse/src/parser/path.rs
@@ -652,12 +652,7 @@ impl<'a> Parser<'a> {
     pub(super) fn parse_const_arg(&mut self) -> PResult<'a, AnonConst> {
         // Parse const argument.
         let value = if let token::OpenDelim(Delimiter::Brace) = self.token.kind {
-            self.parse_block_expr(
-                None,
-                self.token.span,
-                BlockCheckMode::Default,
-                ast::AttrVec::new(),
-            )?
+            self.parse_block_expr(None, self.token.span, BlockCheckMode::Default)?
         } else {
             self.handle_unambiguous_unbraced_const_arg()?
         };