Skip to content

Commit 909898d

Browse files
committed
1 parent 3396974 commit 909898d

File tree

2 files changed

+6
-8
lines changed
  • examples/restriction
    • ref_aware_redundant_closure_for_method_calls/src
    • suboptimal_pattern/src

2 files changed

+6
-8
lines changed

examples/restriction/ref_aware_redundant_closure_for_method_calls/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ use clippy_utils::usage::{local_used_after_expr, local_used_in};
2424
use clippy_utils::{higher, is_adjusted, path_to_local, path_to_local_id};
2525
use rustc_errors::Applicability;
2626
use rustc_hir::def_id::DefId;
27-
use rustc_hir::{
28-
BindingAnnotation, Expr, ExprKind, FnRetTy, Param, PatKind, QPath, TyKind, Unsafety,
29-
};
27+
use rustc_hir::{BindingMode, Expr, ExprKind, FnRetTy, Param, PatKind, QPath, TyKind, Unsafety};
3028
use rustc_infer::infer::TyCtxtInferExt;
3129
use rustc_lint::{LateContext, LateLintPass};
3230
use rustc_middle::ty::{
@@ -247,7 +245,7 @@ fn check_inputs(
247245
.map(|(p, arg)| {
248246
if matches!(
249247
p.pat.kind,
250-
PatKind::Binding(BindingAnnotation::NONE | BindingAnnotation::MUT, id, _, None)
248+
PatKind::Binding(BindingMode::NONE | BindingMode::MUT, id, _, None)
251249
if path_to_local_id(arg, id)
252250
) {
253251
method_name_from_adjustments(cx, cx.typeck_results().expr_adjustments(arg))

examples/restriction/suboptimal_pattern/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rustc_errors::Applicability;
1919
use rustc_hir::{
2020
def_id::LocalDefId,
2121
intravisit::{walk_expr, FnKind, Visitor},
22-
BindingAnnotation, Body, ByRef, Expr, ExprKind, FnDecl, HirId, Node, Pat, PatKind, UnOp,
22+
BindingMode, Body, ByRef, Expr, ExprKind, FnDecl, HirId, Node, Pat, PatKind, UnOp,
2323
};
2424
use rustc_lint::{LateContext, LateLintPass};
2525
use rustc_middle::ty::{self, adjustment::Adjust};
@@ -121,7 +121,7 @@ impl<'tcx> LateLintPass<'tcx> for SuboptimalPattern {
121121
let (referent_ty, n_refs) = peel_mid_ty_refs(pat_ty);
122122

123123
if let ty::Tuple(tys) = referent_ty.kind()
124-
&& let PatKind::Binding(BindingAnnotation(ByRef::No, _), hir_id, ident, None) =
124+
&& let PatKind::Binding(BindingMode(ByRef::No, _), hir_id, ident, None) =
125125
pat.kind
126126
&& let Some(projections) = exclusively_projected(cx.tcx, hir_id, body.value)
127127
{
@@ -253,10 +253,10 @@ fn collect_non_ref_idents(pat: &Pat<'_>) -> Option<FxHashSet<HirId>> {
253253
pat.walk(|pat| {
254254
if let PatKind::Binding(annotation, _, _, _) = pat.kind {
255255
match annotation {
256-
BindingAnnotation(ByRef::No, _) => {
256+
BindingMode(ByRef::No, _) => {
257257
hir_ids.as_mut().map(|hir_ids| hir_ids.insert(pat.hir_id));
258258
}
259-
BindingAnnotation(ByRef::Yes(_), _) => {
259+
BindingMode(ByRef::Yes(_), _) => {
260260
hir_ids = None;
261261
}
262262
}

0 commit comments

Comments
 (0)