about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-07-28 05:25:23 +0000
committerbors <bors@rust-lang.org>2025-07-28 05:25:23 +0000
commitd242a8bd5a73f633ba1ec5aacf19acf35a3c747d (patch)
tree0c2c8a3f7ebcbd838f4afef27acad292c7b0bab1 /compiler/rustc_errors/src
parent733dab558992d902d6d17576de1da768094e2cf3 (diff)
parentb8eb046e6ee3294969bf8faf31da226b0ea29d18 (diff)
downloadrust-d242a8bd5a73f633ba1ec5aacf19acf35a3c747d.tar.gz
rust-d242a8bd5a73f633ba1ec5aacf19acf35a3c747d.zip
Auto merge of #144469 - Kivooeo:chains-cleanup, r=SparrowLii
Some `let chains` clean-up

Not sure if this kind of clean-up is welcoming because of size, but I decided to try out one

r? compiler
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/styled_buffer.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_errors/src/styled_buffer.rs b/compiler/rustc_errors/src/styled_buffer.rs
index 790efd0286e..095502e80aa 100644
--- a/compiler/rustc_errors/src/styled_buffer.rs
+++ b/compiler/rustc_errors/src/styled_buffer.rs
@@ -153,12 +153,11 @@ impl StyledBuffer {
     /// 1. That line and column exist in `StyledBuffer`
     /// 2. `overwrite` is `true` or existing style is `Style::NoStyle` or `Style::Quotation`
     fn set_style(&mut self, line: usize, col: usize, style: Style, overwrite: bool) {
-        if let Some(ref mut line) = self.lines.get_mut(line) {
-            if let Some(StyledChar { style: s, .. }) = line.get_mut(col) {
-                if overwrite || matches!(s, Style::NoStyle | Style::Quotation) {
-                    *s = style;
-                }
-            }
+        if let Some(ref mut line) = self.lines.get_mut(line)
+            && let Some(StyledChar { style: s, .. }) = line.get_mut(col)
+            && (overwrite || matches!(s, Style::NoStyle | Style::Quotation))
+        {
+            *s = style;
         }
     }
 }