Skip to content

Commit fc36195

Browse files
Improve code
1 parent 1046b24 commit fc36195

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/librustdoc/html/highlight.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,10 @@ impl<F: Write> TokenHandler<'_, '_, F> {
233233
} else {
234234
None
235235
};
236-
let mut last_pending = None;
237236
// To prevent opening a macro expansion span being closed right away because
238237
// the currently open item is replaced by a new class.
239-
if let Some((_, Some(Class::Expansion))) = self.pending_elems.last() {
240-
last_pending = self.pending_elems.pop();
241-
}
238+
let last_pending =
239+
self.pending_elems.pop_if(|(_, class)| *class == Some(Class::Expansion));
242240
for (text, class) in self.pending_elems.iter() {
243241
string(
244242
self.out,

0 commit comments

Comments
 (0)