diff options
| author | Ralf Jung <post@ralfj.de> | 2020-09-20 15:52:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-20 15:52:01 +0200 |
| commit | 8405d50e128d7c8ed38f8e0f7432d3c2dfb31195 (patch) | |
| tree | d8f86be28992ce8ac5d0789a3bd121d5cb29ad55 /compiler/rustc_errors/src | |
| parent | f24d279084efa0467369b3578b0d1f4dcae8a687 (diff) | |
| parent | 40dddd33059344b546a11f150c0ec63e797f021c (diff) | |
| download | rust-8405d50e128d7c8ed38f8e0f7432d3c2dfb31195.tar.gz rust-8405d50e128d7c8ed38f8e0f7432d3c2dfb31195.zip | |
Rollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnr
use matches!() macro for simple if let conditions
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/snippet.rs | 8 |
1 files changed, 3 insertions, 5 deletions
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 { |
