1 use clippy_utils::diagnostics::span_lint_and_sugg;
2 use rustc_ast::ast::{Pat, PatKind};
3 use rustc_errors::Applicability;
4 use rustc_lint::EarlyContext;
6 use super::REDUNDANT_PATTERN;
8 pub(super) fn check(cx: &EarlyContext<'_>, pat: &Pat) {
9 if let PatKind::Ident(ann, ident, Some(ref right)) = pat.kind {
10 if let PatKind::Wild = right.kind {
16 "the `{} @ _` pattern can be written as just `{}`",
17 ident.name, ident.name,
20 format!("{}{}", ann.prefix_str(), ident.name),
21 Applicability::MachineApplicable,