]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_errors/src/snippet.rs
use matches!() macro for simple if let conditions
[rust.git] / compiler / rustc_errors / src / snippet.rs
index 160bf57779970a58ab0b6369a5736534c634c5e4..fae5b94b3a81edc650fd124051888f4b919e47c7 100644 (file)
@@ -118,17 +118,15 @@ pub struct Annotation {
 impl Annotation {
     /// Whether this annotation is a vertical line placeholder.
     pub fn is_line(&self) -> bool {
-        if let AnnotationType::MultilineLine(_) = self.annotation_type { true } else { false }
+        matches!(self.annotation_type, AnnotationType::MultilineLine(_))
     }
 
     pub fn is_multiline(&self) -> bool {
-        match self.annotation_type {
+        matches!(self.annotation_type,
             AnnotationType::Multiline(_)
             | AnnotationType::MultilineStart(_)
             | AnnotationType::MultilineLine(_)
-            | AnnotationType::MultilineEnd(_) => true,
-            _ => false,
-        }
+            | AnnotationType::MultilineEnd(_))
     }
 
     pub fn len(&self) -> usize {