diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-07-01 16:50:06 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-07-02 10:46:44 +1000 |
| commit | 2342770f49dcc7e98069efb2db3620d4803c7698 (patch) | |
| tree | 08732a3059a711256e47da7fcc039eab18b353f3 /compiler/rustc_parse/src/parser | |
| parent | 36c30a968b60a2926a0f600feb78eaba618d8d9a (diff) | |
| download | rust-2342770f49dcc7e98069efb2db3620d4803c7698.tar.gz rust-2342770f49dcc7e98069efb2db3620d4803c7698.zip | |
Flip an if/else in `AttrTokenStream::to_attr_token_stream`.
To put the simple case first.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/attr_wrapper.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/attr_wrapper.rs b/compiler/rustc_parse/src/parser/attr_wrapper.rs index a5aaa9f0522..244a4f26fba 100644 --- a/compiler/rustc_parse/src/parser/attr_wrapper.rs +++ b/compiler/rustc_parse/src/parser/attr_wrapper.rs @@ -112,7 +112,9 @@ impl ToAttrTokenStream for LazyAttrTokenStreamImpl { })) .take(self.num_calls); - if !self.replace_ranges.is_empty() { + if self.replace_ranges.is_empty() { + make_token_stream(tokens, self.break_last_token) + } else { let mut tokens: Vec<_> = tokens.collect(); let mut replace_ranges = self.replace_ranges.to_vec(); replace_ranges.sort_by_key(|(range, _)| range.start); @@ -165,8 +167,6 @@ impl ToAttrTokenStream for LazyAttrTokenStreamImpl { ); } make_token_stream(tokens.into_iter(), self.break_last_token) - } else { - make_token_stream(tokens, self.break_last_token) } } } |
