pub fn snippet_with_applicability<'a, 'sm>(
sm: impl HasSourceMap<'sm>,
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
If the span might realistically contain a macro call (e.g. vec![]), consider using
snippet_with_context instead.