use matches!() macro for simple if let conditions

This commit is contained in:
Matthias Krüger 2020-09-18 19:11:06 +02:00
parent 2c69266c06
commit 40dddd3305
15 changed files with 33 additions and 36 deletions

View 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 {