Auto merge of #9834 - koka831:refac/manual-is-ascii-check, r=xFrednet

refac: remove unnecessary mutability

refactor `manual_is_ascii_check` lint.

* remove unnecessary mutability
* fix typo

changelog: none

r? `@xFrednet`
This commit is contained in:
bors 2022-11-12 11:44:22 +00:00
commit 755fe4dc24

View file

@ -91,15 +91,16 @@ impl<'tcx> LateLintPass<'tcx> for ManualIsAsciiCheck {
CharRange::Digit => Some("is_ascii_digit"),
CharRange::Otherwise => None,
} {
let mut applicability = Applicability::MaybeIncorrect;
let default_snip = "..";
// `snippet_with_applicability` may set applicability to `MaybeIncorrect` for
// macro span, so we check applicability manually by comaring `recv` is not default.
// macro span, so we check applicability manually by comparing `recv` is not default.
let recv = snippet(cx, recv.span, default_snip);
if recv != default_snip {
applicability = Applicability::MachineApplicable;
}
let applicability = if recv == default_snip {
Applicability::HasPlaceholders
} else {
Applicability::MachineApplicable
};
span_lint_and_sugg(
cx,