fix: use HasPlaceholders

* remove unnecessary mutability
* fix typo
This commit is contained in:
koka 2022-11-12 19:15:21 +09:00
parent cad0d3d6da
commit 39398e163a
No known key found for this signature in database
GPG key ID: A5917A40697774CD

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,