mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
Fix spelling while we're in the neighborhood.
This commit is contained in:
parent
d0c1605d51
commit
755ae3fa29
@ -30,7 +30,7 @@ pub(super) fn check<'tcx>(
|
||||
if let Body {params: [p], value: body_expr, generator_kind: _ } = cx.tcx.hir().body(c.body);
|
||||
if let PatKind::Tuple([key_pat, val_pat], _) = p.pat.kind;
|
||||
|
||||
let (replacement_kind, annotation, binded_ident) = match (&key_pat.kind, &val_pat.kind) {
|
||||
let (replacement_kind, annotation, bound_ident) = match (&key_pat.kind, &val_pat.kind) {
|
||||
(key, PatKind::Binding(ann, _, value, _)) if pat_is_wild(cx, key, m_arg) => ("value", ann, value),
|
||||
(PatKind::Binding(ann, _, key, _), value) if pat_is_wild(cx, value, m_arg) => ("key", ann, key),
|
||||
_ => return,
|
||||
@ -47,7 +47,7 @@ pub(super) fn check<'tcx>(
|
||||
if_chain! {
|
||||
if let ExprKind::Path(rustc_hir::QPath::Resolved(_, path)) = body_expr.kind;
|
||||
if let [local_ident] = path.segments;
|
||||
if local_ident.ident.as_str() == binded_ident.as_str();
|
||||
if local_ident.ident.as_str() == bound_ident.as_str();
|
||||
|
||||
then {
|
||||
span_lint_and_sugg(
|
||||
@ -76,7 +76,7 @@ pub(super) fn check<'tcx>(
|
||||
expr.span,
|
||||
&format!("iterating on a map's {replacement_kind}s"),
|
||||
"try",
|
||||
format!("{recv_snippet}.{into_prefix}{replacement_kind}s().map(|{ref_annotation}{mut_annotation}{binded_ident}| {})",
|
||||
format!("{recv_snippet}.{into_prefix}{replacement_kind}s().map(|{ref_annotation}{mut_annotation}{bound_ident}| {})",
|
||||
snippet_with_applicability(cx, body_expr.span, "/* body */", &mut applicability)),
|
||||
applicability,
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user