Skip to content

Commit 4288edb

Browse files
committed
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.
1 parent caee195 commit 4288edb

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

compiler/rustc_parse/src/parser/attr_wrapper.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ impl AttrWrapper {
6060
pub fn is_empty(&self) -> bool {
6161
self.attrs.is_empty()
6262
}
63-
64-
pub fn is_complete(&self) -> bool {
65-
crate::parser::attr::is_complete(&self.attrs)
66-
}
6763
}
6864

6965
/// Returns `true` if `attrs` contains a `cfg` or `cfg_attr` attribute
@@ -205,7 +201,7 @@ impl<'a> Parser<'a> {
205201
// tokens by definition).
206202
let needs_collection = matches!(force_collect, ForceCollect::Yes)
207203
// - Any of our outer attributes require tokens.
208-
|| !attrs.is_complete()
204+
|| !crate::parser::attr::is_complete(&attrs.attrs)
209205
// - Our target supports custom inner attributes (custom
210206
// inner attribute invocation might require token capturing).
211207
|| R::SUPPORTS_CUSTOM_INNER_ATTRS
@@ -261,9 +257,9 @@ impl<'a> Parser<'a> {
261257
// - We are force collecting tokens.
262258
let needs_collection = matches!(force_collect, ForceCollect::Yes)
263259
// - Any of our outer *or* inner attributes require tokens.
264-
// (`attrs` was just outer attributes, but `ret.attrs()` is outer
265-
// and inner attributes. So this check is more precise than the
266-
// earlier `attrs.is_complete()` check, and we don't need to
260+
// (`attr.attrs` was just outer attributes, but `ret.attrs()` is
261+
// outer and inner attributes. So this check is more precise than
262+
// the earlier `is_complete()` check, and we don't need to
267263
// check `R::SUPPORTS_CUSTOM_INNER_ATTRS`.)
268264
|| !crate::parser::attr::is_complete(ret.attrs())
269265
// - We are in `capture_cfg` mode and there are `#[cfg]` or

0 commit comments

Comments
 (0)