Skip to content

Commit 260936d

Browse files
Fix detection of macro file in inactive-code diag
1 parent 1b02caf commit 260936d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

crates/hir_expand/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ impl HirFileId {
173173
_ => false,
174174
}
175175
}
176+
177+
pub fn is_macro(self) -> bool {
178+
matches!(self.0, HirFileIdRepr::MacroFile(_))
179+
}
176180
}
177181

178182
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]

crates/ide_diagnostics/src/handlers/inactive_code.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub(crate) fn inactive_code(
1111
d: &hir::InactiveCode,
1212
) -> Option<Diagnostic> {
1313
// If there's inactive code somewhere in a macro, don't propagate to the call-site.
14-
if d.node.file_id.expansion_info(ctx.sema.db).is_some() {
14+
if d.node.file_id.is_macro() {
1515
return None;
1616
}
1717

0 commit comments

Comments
 (0)