From 40dddd33059344b546a11f150c0ec63e797f021c Mon Sep 17 00:00:00 2001 From: Matthias Krüger Date: Fri, 18 Sep 2020 19:11:06 +0200 Subject: use matches!() macro for simple if let conditions --- compiler/rustc_errors/src/snippet.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'compiler/rustc_errors/src/snippet.rs') diff --git a/compiler/rustc_errors/src/snippet.rs b/compiler/rustc_errors/src/snippet.rs index 160bf577799..fae5b94b3a8 100644 --- a/compiler/rustc_errors/src/snippet.rs +++ b/compiler/rustc_errors/src/snippet.rs @@ -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 { -- cgit 1.4.1-3-g733a5