about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorklensy <klensy@users.noreply.github.com>2021-04-16 05:23:40 +0300
committerklensy <klensy@users.noreply.github.com>2021-04-16 05:23:40 +0300
commit247d74f207633a5aeceb1e0ede878427465c5093 (patch)
treea3e910069e933201cc9a7e21bace6a91c8360f4b /compiler/rustc_errors/src
parent7e9d3c6f6cf3956dbf2a7870cebe89ebeb5d9ea5 (diff)
downloadrust-247d74f207633a5aeceb1e0ede878427465c5093.tar.gz
rust-247d74f207633a5aeceb1e0ede878427465c5093.zip
StyledBuffer::set_style: check overwrite first
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/styled_buffer.rs4
1 files changed, 2 insertions, 2 deletions
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 @@ impl StyledBuffer {
 
     /// 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;
                 }
             }