Function clippy_utils::source::snippet_with_applicability
source · pub fn snippet_with_applicability<'a, T: LintContext>(
cx: &T,
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
Unspecifiedwill 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