new lint: init-numbered-fields

This commit is contained in:
Andre Bogus
2021-12-25 16:52:58 +01:00
parent 547efad945
commit 3ebd2bc2e4
11 changed files with 198 additions and 7 deletions

View File

@@ -142,6 +142,13 @@ macro_rules! extract_msrv_attr {
};
}
/// Returns `true` if the span comes from a macro expansion, no matter if from a
/// macro by example or from a procedural macro
#[must_use]
pub fn in_macro(span: Span) -> bool {
span.from_expansion() && !matches!(span.ctxt().outer_expn_data().kind, ExpnKind::Desugaring(..))
}
/// Returns `true` if the two spans come from differing expansions (i.e., one is
/// from a macro and one isn't).
#[must_use]