diff --git a/compiler/rustc_errors/src/styled_buffer.rs b/compiler/rustc_errors/src/styled_buffer.rs index 9c19c96d64f..01d2a8de39d 100644 --- a/compiler/rustc_errors/src/styled_buffer.rs +++ b/compiler/rustc_errors/src/styled_buffer.rs @@ -148,11 +148,11 @@ pub fn set_style_range( /// Set `style` for `line`, `col` if: /// 1. That line and column exist in `StyledBuffer` - /// 2. Existing style is `Style::NoStyle` or `Style::Quotation` or `overwrite` is `true` + /// 2. `overwrite` is `true` or existing style is `Style::NoStyle` or `Style::Quotation` pub fn set_style(&mut self, line: usize, col: usize, style: Style, overwrite: bool) { if let Some(ref mut line) = self.text.get_mut(line) { if let Some(StyledChar { style: s, .. }) = line.get_mut(col) { - if *s == Style::NoStyle || *s == Style::Quotation || overwrite { + if overwrite || *s == Style::NoStyle || *s == Style::Quotation { *s = style; } }