about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorAnthonyMikh <anthony.mikh@yandex.ru>2019-09-26 00:42:55 +0300
committerGitHub <noreply@github.com>2019-09-26 00:42:55 +0300
commit7a0725fdaf964fa1bf60eefb0cc5846b687426bf (patch)
tree0174b59e7e8b0b46a53aecc624838d6a190f2e12 /src/librustc_errors
parentea328625039229f9ad0002a68f1a86691a065cf6 (diff)
downloadrust-7a0725fdaf964fa1bf60eefb0cc5846b687426bf.tar.gz
rust-7a0725fdaf964fa1bf60eefb0cc5846b687426bf.zip
Simplify `style_or_override`
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/emitter.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index 7513a9203fe..b8b7488d8ae 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -1066,13 +1066,11 @@ impl EmitterWriter {
         let padding = " ".repeat(padding + label.len() + 5);
 
         /// Returns `true` if `style`, or the override if present and the style is `NoStyle`.
-        fn style_or_override(style: Style, override_style: Option<Style>) -> Style {
-            if let Some(o) = override_style {
-                if style == Style::NoStyle {
-                    return o;
-                }
+        fn style_or_override(style: Style, override: Option<Style>) -> Style {
+            match (style, override) {
+                (Style::NoStyle, Some(override)) => override,
+                _ => style,
             }
-            style
         }
 
         let mut line_number = 0;