about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-08-08 11:42:46 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2023-10-12 08:46:15 +1100
commitbb9c2f50c378d494e14f5d3062ed88ea90749637 (patch)
tree30bb811fb5bdc32135bc7ae59fd311ba9b4ad171 /compiler/rustc_parse/src
parent129fe9a998e611f3b16da9156934fc78149e0860 (diff)
downloadrust-bb9c2f50c378d494e14f5d3062ed88ea90749637.tar.gz
rust-bb9c2f50c378d494e14f5d3062ed88ea90749637.zip
Reorder an expression to improve readability.
Diffstat (limited to 'compiler/rustc_parse/src')
-rw-r--r--compiler/rustc_parse/src/lexer/tokentrees.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/compiler/rustc_parse/src/lexer/tokentrees.rs b/compiler/rustc_parse/src/lexer/tokentrees.rs
index 7cdb1970470..1d9dbfe4b89 100644
--- a/compiler/rustc_parse/src/lexer/tokentrees.rs
+++ b/compiler/rustc_parse/src/lexer/tokentrees.rs
@@ -55,19 +55,14 @@ impl<'a> TokenTreesReader<'a> {
                     let (this_spacing, next_tok) = loop {
                         let (next_tok, is_next_tok_preceded_by_whitespace) =
                             self.string_reader.next_token();
-                        if !is_next_tok_preceded_by_whitespace {
-                            if let Some(glued) = self.token.glue(&next_tok) {
-                                self.token = glued;
-                            } else {
-                                let this_spacing = if next_tok.is_punct() {
-                                    Spacing::Joint
-                                } else {
-                                    Spacing::Alone
-                                };
-                                break (this_spacing, next_tok);
-                            }
-                        } else {
+                        if is_next_tok_preceded_by_whitespace {
                             break (Spacing::Alone, next_tok);
+                        } else if let Some(glued) = self.token.glue(&next_tok) {
+                            self.token = glued;
+                        } else {
+                            let this_spacing =
+                                if next_tok.is_punct() { Spacing::Joint } else { Spacing::Alone };
+                            break (this_spacing, next_tok);
                         }
                     };
                     let this_tok = std::mem::replace(&mut self.token, next_tok);