aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/diagnostics.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs
index c92c1c066..394365bc8 100644
--- a/crates/ide/src/diagnostics.rs
+++ b/crates/ide/src/diagnostics.rs
@@ -10,7 +10,10 @@ mod field_shorthand;
10use std::cell::RefCell; 10use std::cell::RefCell;
11 11
12use base_db::SourceDatabase; 12use base_db::SourceDatabase;
13use hir::{diagnostics::DiagnosticSinkBuilder, Semantics}; 13use hir::{
14 diagnostics::{Diagnostic as _, DiagnosticSinkBuilder},
15 Semantics,
16};
14use ide_db::RootDatabase; 17use ide_db::RootDatabase;
15use itertools::Itertools; 18use itertools::Itertools;
16use rustc_hash::FxHashSet; 19use rustc_hash::FxHashSet;
@@ -46,6 +49,10 @@ impl Diagnostic {
46 fn with_fix(self, fix: Option<Fix>) -> Self { 49 fn with_fix(self, fix: Option<Fix>) -> Self {
47 Self { fix, ..self } 50 Self { fix, ..self }
48 } 51 }
52
53 fn with_unused(self, unused: bool) -> Self {
54 Self { unused, ..self }
55 }
49} 56}
50 57
51#[derive(Debug)] 58#[derive(Debug)]
@@ -115,6 +122,13 @@ pub(crate) fn diagnostics(
115 .on::<hir::diagnostics::IncorrectCase, _>(|d| { 122 .on::<hir::diagnostics::IncorrectCase, _>(|d| {
116 res.borrow_mut().push(warning_with_fix(d, &sema)); 123 res.borrow_mut().push(warning_with_fix(d, &sema));
117 }) 124 })
125 .on::<hir::diagnostics::UnconfiguredCode, _>(|d| {
126 // Override severity and mark as unused.
127 res.borrow_mut().push(
128 Diagnostic::hint(sema.diagnostics_display_range(d).range, d.message())
129 .with_unused(true),
130 );
131 })
118 // Only collect experimental diagnostics when they're enabled. 132 // Only collect experimental diagnostics when they're enabled.
119 .filter(|diag| !(diag.is_experimental() && config.disable_experimental)) 133 .filter(|diag| !(diag.is_experimental() && config.disable_experimental))
120 .filter(|diag| !config.disabled.contains(diag.code().as_str())); 134 .filter(|diag| !config.disabled.contains(diag.code().as_str()));