Function clippy_utils::source::snippet_with_applicability
source ยท pub fn snippet_with_applicability<'a>(
sess: &impl HasSession,
span: Span,
default: &'a str,
applicability: &mut Applicability,
) -> Cow<'a, str>
Expand description
Same as snippet
, but it adapts the applicability level by following rules:
- Applicability level
Unspecified
will never be changed. - If the span is inside a macro, change the applicability level to
MaybeIncorrect
. - If the default value is used and the applicability level is
MachineApplicable
, change it toHasPlaceholders