aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-12-03 19:46:16 +0000
committerJonas Schievink <[email protected]>2020-12-03 19:46:16 +0000
commit6e1c87eb92f129cc6f5977b8b0f5893de4ae8d78 (patch)
treed001026a17e5099d8df5259ded74b6ad4b2ce1fa /crates/ide/src
parent070ecef24912910417ca723cb2f1d1b350cc79d8 (diff)
Don't diagnose `#[cfg]` in macros
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/diagnostics.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs
index 9d3d88289..c8453edb3 100644
--- a/crates/ide/src/diagnostics.rs
+++ b/crates/ide/src/diagnostics.rs
@@ -135,6 +135,11 @@ pub(crate) fn diagnostics(
135 res.borrow_mut().push(warning_with_fix(d, &sema)); 135 res.borrow_mut().push(warning_with_fix(d, &sema));
136 }) 136 })
137 .on::<hir::diagnostics::InactiveCode, _>(|d| { 137 .on::<hir::diagnostics::InactiveCode, _>(|d| {
138 // If there's inactive code somewhere in a macro, don't propagate to the call-site.
139 if d.display_source().file_id.expansion_info(db).is_some() {
140 return;
141 }
142
138 // Override severity and mark as unused. 143 // Override severity and mark as unused.
139 res.borrow_mut().push( 144 res.borrow_mut().push(
140 Diagnostic::hint(sema.diagnostics_display_range(d).range, d.message()) 145 Diagnostic::hint(sema.diagnostics_display_range(d).range, d.message())