Reorder an expression to improve readability.

This commit is contained in:
Nicholas Nethercote 2023-08-08 11:42:46 +10:00
parent 129fe9a998
commit bb9c2f50c3

View File

@ -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);