diff --git a/helix-core/src/diagnostic.rs b/helix-core/src/diagnostic.rs index da199ac9cb12..db1f2da9c313 100644 --- a/helix-core/src/diagnostic.rs +++ b/helix-core/src/diagnostic.rs @@ -43,6 +43,6 @@ pub struct Diagnostic { pub message: String, pub severity: Option, pub code: Option, - pub tags: Option>, + pub tags: Vec, pub source: Option, } diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 8c76c4a8137e..8d43410a3226 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 diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 496464f01434..cd499f1c3d11 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -614,9 +614,9 @@ impl Application { } }).collect(); - Some(new_tags) + new_tags } else { - None + Vec::new() }; Some(Diagnostic {