Skip to content

Commit

Permalink
Account for rust-lang/rust#124047
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed May 14, 2024
1 parent 39d2db6 commit edf6d03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ use clippy_utils::usage::{local_used_after_expr, local_used_in};
use clippy_utils::{higher, is_adjusted, path_to_local, path_to_local_id};
use rustc_errors::Applicability;
use rustc_hir::def_id::DefId;
use rustc_hir::{
BindingAnnotation, Expr, ExprKind, FnRetTy, Param, PatKind, QPath, TyKind, Unsafety,
};
use rustc_hir::{BindingMode, Expr, ExprKind, FnRetTy, Param, PatKind, QPath, TyKind, Unsafety};
use rustc_infer::infer::TyCtxtInferExt;
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::{
Expand Down Expand Up @@ -247,7 +245,7 @@ fn check_inputs(
.map(|(p, arg)| {
if matches!(
p.pat.kind,
PatKind::Binding(BindingAnnotation::NONE | BindingAnnotation::MUT, id, _, None)
PatKind::Binding(BindingMode::NONE | BindingMode::MUT, id, _, None)
if path_to_local_id(arg, id)
) {
method_name_from_adjustments(cx, cx.typeck_results().expr_adjustments(arg))
Expand Down
8 changes: 4 additions & 4 deletions examples/restriction/suboptimal_pattern/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use rustc_errors::Applicability;
use rustc_hir::{
def_id::LocalDefId,
intravisit::{walk_expr, FnKind, Visitor},
BindingAnnotation, Body, ByRef, Expr, ExprKind, FnDecl, HirId, Node, Pat, PatKind, UnOp,
BindingMode, Body, ByRef, Expr, ExprKind, FnDecl, HirId, Node, Pat, PatKind, UnOp,
};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::{self, adjustment::Adjust};
Expand Down Expand Up @@ -121,7 +121,7 @@ impl<'tcx> LateLintPass<'tcx> for SuboptimalPattern {
let (referent_ty, n_refs) = peel_mid_ty_refs(pat_ty);

if let ty::Tuple(tys) = referent_ty.kind()
&& let PatKind::Binding(BindingAnnotation(ByRef::No, _), hir_id, ident, None) =
&& let PatKind::Binding(BindingMode(ByRef::No, _), hir_id, ident, None) =
pat.kind
&& let Some(projections) = exclusively_projected(cx.tcx, hir_id, body.value)
{
Expand Down Expand Up @@ -253,10 +253,10 @@ fn collect_non_ref_idents(pat: &Pat<'_>) -> Option<FxHashSet<HirId>> {
pat.walk(|pat| {
if let PatKind::Binding(annotation, _, _, _) = pat.kind {
match annotation {
BindingAnnotation(ByRef::No, _) => {
BindingMode(ByRef::No, _) => {
hir_ids.as_mut().map(|hir_ids| hir_ids.insert(pat.hir_id));
}
BindingAnnotation(ByRef::Yes(_), _) => {
BindingMode(ByRef::Yes(_), _) => {
hir_ids = None;
}
}
Expand Down

0 comments on commit edf6d03

Please sign in to comment.