diff options
author | Blaž Hrastnik | 2022-09-20 07:28:00 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-09-20 07:28:00 +0000 |
commit | 1df32c917c8a386947063403577098d1277380c7 (patch) | |
tree | e1b12844309a833fe44167285d90fa83ed5de045 /helix-lsp | |
parent | 64b074541363c72534dc86d00053ecbd5511a9ca (diff) |
diagnostics: Use Vec<Tag> instead of Option<Vec<Tag>>
Diffstat (limited to 'helix-lsp')
-rw-r--r-- | helix-lsp/src/lib.rs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 8c76c4a8..8d43410a 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -84,19 +84,18 @@ pub mod util { None => None, }; - let tags = if let Some(ref tags) = diag.tags { - let new_tags = tags - .iter() - .map(|tag| match tag { - helix_core::diagnostic::DiagnosticTag::Unnecessary => { - lsp::DiagnosticTag::UNNECESSARY - } - helix_core::diagnostic::DiagnosticTag::Deprecated => { - lsp::DiagnosticTag::DEPRECATED - } - }) - .collect(); + let new_tags: Vec<_> = diag + .tags + .iter() + .map(|tag| match tag { + helix_core::diagnostic::DiagnosticTag::Unnecessary => { + lsp::DiagnosticTag::UNNECESSARY + } + helix_core::diagnostic::DiagnosticTag::Deprecated => lsp::DiagnosticTag::DEPRECATED, + }) + .collect(); + let tags = if !new_tags.is_empty() { Some(new_tags) } else { None |