Flip an if/else in AttrTokenStream::to_attr_token_stream.

To put the simple case first.
This commit is contained in:
Nicholas Nethercote 2024-07-01 16:50:06 +10:00
parent 36c30a968b
commit 2342770f49

View File

@ -112,7 +112,9 @@ fn to_attr_token_stream(&self) -> AttrTokenStream {
}))
.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 @@ fn to_attr_token_stream(&self) -> AttrTokenStream {
);
}
make_token_stream(tokens.into_iter(), self.break_last_token)
} else {
make_token_stream(tokens, self.break_last_token)
}
}
}