about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-07-26 09:00:17 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-07-26 09:44:07 +1000
commit4288edb219fb288af524b490bd3830fc7cfafe02 (patch)
tree710536c7d2ba48e5a616575729a155b56eb1a4ce /compiler/rustc_parse/src/parser
parentcaee195bdd922c25946276625993b93a5bc0eb41 (diff)
downloadrust-4288edb219fb288af524b490bd3830fc7cfafe02.tar.gz
rust-4288edb219fb288af524b490bd3830fc7cfafe02.zip
Inline and remove `AttrWrapper::is_complete`.
It has a single call site. This change makes the two `needs_collect`
conditions more similar to each other, and therefore easier to
understand.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/attr_wrapper.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler/rustc_parse/src/parser/attr_wrapper.rs b/compiler/rustc_parse/src/parser/attr_wrapper.rs
index 6413aa09241..27b899300e7 100644
--- a/compiler/rustc_parse/src/parser/attr_wrapper.rs
+++ b/compiler/rustc_parse/src/parser/attr_wrapper.rs
@@ -60,10 +60,6 @@ impl AttrWrapper {
     pub fn is_empty(&self) -> bool {
         self.attrs.is_empty()
     }
-
-    pub fn is_complete(&self) -> bool {
-        crate::parser::attr::is_complete(&self.attrs)
-    }
 }
 
 /// Returns `true` if `attrs` contains a `cfg` or `cfg_attr` attribute
@@ -205,7 +201,7 @@ impl<'a> Parser<'a> {
         //   tokens by definition).
         let needs_collection = matches!(force_collect, ForceCollect::Yes)
             // - Any of our outer attributes require tokens.
-            || !attrs.is_complete()
+            || !crate::parser::attr::is_complete(&attrs.attrs)
             // - Our target supports custom inner attributes (custom
             //   inner attribute invocation might require token capturing).
             || R::SUPPORTS_CUSTOM_INNER_ATTRS
@@ -261,9 +257,9 @@ impl<'a> Parser<'a> {
         // - We are force collecting tokens.
         let needs_collection = matches!(force_collect, ForceCollect::Yes)
             // - Any of our outer *or* inner attributes require tokens.
-            //   (`attrs` was just outer attributes, but `ret.attrs()` is outer
-            //   and inner attributes. So this check is more precise than the
-            //   earlier `attrs.is_complete()` check, and we don't need to
+            //   (`attr.attrs` was just outer attributes, but `ret.attrs()` is
+            //   outer and inner attributes. So this check is more precise than
+            //   the earlier `is_complete()` check, and we don't need to
             //   check `R::SUPPORTS_CUSTOM_INNER_ATTRS`.)
             || !crate::parser::attr::is_complete(ret.attrs())
             // - We are in `capture_cfg` mode and there are `#[cfg]` or