Skip to content

Commit 876d5f0

Browse files
Rename BindingAnnotation to BindingMode
1 parent 432bce6 commit 876d5f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+104
-104
lines changed

clippy_lints/src/dereference.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_data_structures::fx::FxIndexMap;
99
use rustc_errors::Applicability;
1010
use rustc_hir::intravisit::{walk_ty, Visitor};
1111
use rustc_hir::{
12-
self as hir, BindingAnnotation, Body, BodyId, BorrowKind, Expr, ExprKind, HirId, MatchSource, Mutability, Node,
12+
self as hir, BindingMode, Body, BodyId, BorrowKind, Expr, ExprKind, HirId, MatchSource, Mutability, Node,
1313
Pat, PatKind, Path, QPath, TyKind, UnOp,
1414
};
1515
use rustc_lint::{LateContext, LateLintPass};
@@ -599,7 +599,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
599599
}
600600

601601
fn check_pat(&mut self, cx: &LateContext<'tcx>, pat: &'tcx Pat<'_>) {
602-
if let PatKind::Binding(BindingAnnotation::REF, id, name, _) = pat.kind {
602+
if let PatKind::Binding(BindingMode::REF, id, name, _) = pat.kind {
603603
if let Some(opt_prev_pat) = self.ref_locals.get_mut(&id) {
604604
// This binding id has been seen before. Add this pattern to the list of changes.
605605
if let Some(prev_pat) = opt_prev_pat {

clippy_lints/src/eta_reduction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use clippy_utils::ty::type_diagnostic_name;
55
use clippy_utils::usage::{local_used_after_expr, local_used_in};
66
use clippy_utils::{get_path_from_caller_to_method_type, is_adjusted, path_to_local, path_to_local_id};
77
use rustc_errors::Applicability;
8-
use rustc_hir::{BindingAnnotation, Expr, ExprKind, FnRetTy, Param, PatKind, QPath, TyKind, Unsafety};
8+
use rustc_hir::{BindingMode, Expr, ExprKind, FnRetTy, Param, PatKind, QPath, TyKind, Unsafety};
99
use rustc_infer::infer::TyCtxtInferExt;
1010
use rustc_lint::{LateContext, LateLintPass};
1111
use rustc_middle::ty::{
@@ -229,7 +229,7 @@ fn check_inputs(
229229
&& params.iter().zip(self_arg.into_iter().chain(args)).all(|(p, arg)| {
230230
matches!(
231231
p.pat.kind,
232-
PatKind::Binding(BindingAnnotation::NONE, id, _, None)
232+
PatKind::Binding(BindingMode::NONE, id, _, None)
233233
if path_to_local_id(arg, id)
234234
)
235235
// Only allow adjustments which change regions (i.e. re-borrowing).

clippy_lints/src/explicit_write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clippy_utils::source::snippet_with_applicability;
44
use clippy_utils::{is_expn_of, path_def_id};
55
use rustc_errors::Applicability;
66
use rustc_hir::def::Res;
7-
use rustc_hir::{BindingAnnotation, Block, BlockCheckMode, Expr, ExprKind, Node, PatKind, QPath, Stmt, StmtKind};
7+
use rustc_hir::{BindingMode, Block, BlockCheckMode, Expr, ExprKind, Node, PatKind, QPath, Stmt, StmtKind};
88
use rustc_lint::{LateContext, LateLintPass};
99
use rustc_session::declare_lint_pass;
1010
use rustc_span::{sym, ExpnId};
@@ -114,7 +114,7 @@ fn look_in_block<'tcx, 'hir>(cx: &LateContext<'tcx>, kind: &'tcx ExprKind<'hir>)
114114
&& let Node::Pat(res_pat) = cx.tcx.hir_node(expr_res)
115115

116116
// Find id of the local we found in the block
117-
&& let PatKind::Binding(BindingAnnotation::NONE, local_hir_id, _ident, None) = local.pat.kind
117+
&& let PatKind::Binding(BindingMode::NONE, local_hir_id, _ident, None) = local.pat.kind
118118

119119
// If those two are the same hir id
120120
&& res_pat.hir_id == local_hir_id

clippy_lints/src/index_refutable_slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn find_slice_values(cx: &LateContext<'_>, pat: &hir::Pat<'_>) -> FxIndexMap<Hir
9494
pat.walk_always(|pat| {
9595
// We'll just ignore mut and ref mut for simplicity sake right now
9696
if let hir::PatKind::Binding(
97-
hir::BindingAnnotation(by_ref, hir::Mutability::Not),
97+
hir::BindingMode(by_ref, hir::Mutability::Not),
9898
value_hir_id,
9999
ident,
100100
sub_pat,

clippy_lints/src/let_if_seq.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clippy_utils::source::snippet;
44
use clippy_utils::visitors::is_local_used;
55
use rustc_errors::Applicability;
66
use rustc_hir as hir;
7-
use rustc_hir::{BindingAnnotation, Mutability};
7+
use rustc_hir::{BindingMode, Mutability};
88
use rustc_lint::{LateContext, LateLintPass};
99
use rustc_session::declare_lint_pass;
1010

@@ -106,7 +106,7 @@ impl<'tcx> LateLintPass<'tcx> for LetIfSeq {
106106
};
107107

108108
let mutability = match mode {
109-
BindingAnnotation(_, Mutability::Mut) => "<mut> ",
109+
BindingMode(_, Mutability::Mut) => "<mut> ",
110110
_ => "",
111111
};
112112

clippy_lints/src/loops/manual_find.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use clippy_utils::{higher, is_res_lang_ctor, path_res, peel_blocks_with_stmt};
77
use rustc_errors::Applicability;
88
use rustc_hir::def::Res;
99
use rustc_hir::lang_items::LangItem;
10-
use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, HirId, Node, Pat, PatKind, Stmt, StmtKind};
10+
use rustc_hir::{BindingMode, Block, Expr, ExprKind, HirId, Node, Pat, PatKind, Stmt, StmtKind};
1111
use rustc_lint::LateContext;
1212
use rustc_span::Span;
1313

@@ -107,7 +107,7 @@ fn get_binding(pat: &Pat<'_>) -> Option<HirId> {
107107
hir_id = None;
108108
return;
109109
}
110-
if let BindingAnnotation::NONE = annotation {
110+
if let BindingMode::NONE = annotation {
111111
hir_id = Some(id);
112112
}
113113
});

clippy_lints/src/loops/mut_range_bound.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::MUT_RANGE_BOUND;
22
use clippy_utils::diagnostics::span_lint_and_note;
33
use clippy_utils::{get_enclosing_block, higher, path_to_local};
44
use rustc_hir::intravisit::{self, Visitor};
5-
use rustc_hir::{BindingAnnotation, Expr, ExprKind, HirId, Node, PatKind};
5+
use rustc_hir::{BindingMode, Expr, ExprKind, HirId, Node, PatKind};
66
use rustc_hir_typeck::expr_use_visitor::{Delegate, ExprUseVisitor, PlaceBase, PlaceWithHirId};
77
use rustc_infer::infer::TyCtxtInferExt;
88
use rustc_lint::LateContext;
@@ -41,7 +41,7 @@ fn mut_warn_with_span(cx: &LateContext<'_>, span: Option<Span>) {
4141
fn check_for_mutability(cx: &LateContext<'_>, bound: &Expr<'_>) -> Option<HirId> {
4242
if let Some(hir_id) = path_to_local(bound)
4343
&& let Node::Pat(pat) = cx.tcx.hir_node(hir_id)
44-
&& let PatKind::Binding(BindingAnnotation::MUT, ..) = pat.kind
44+
&& let PatKind::Binding(BindingMode::MUT, ..) = pat.kind
4545
{
4646
return Some(hir_id);
4747
}

clippy_lints/src/loops/same_item_push.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_data_structures::fx::FxHashSet;
77
use rustc_errors::Applicability;
88
use rustc_hir::def::{DefKind, Res};
99
use rustc_hir::intravisit::{walk_expr, Visitor};
10-
use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, HirId, Mutability, Node, Pat, PatKind, Stmt, StmtKind};
10+
use rustc_hir::{BindingMode, Block, Expr, ExprKind, HirId, Mutability, Node, Pat, PatKind, Stmt, StmtKind};
1111
use rustc_lint::LateContext;
1212
use rustc_span::symbol::sym;
1313
use rustc_span::SyntaxContext;
@@ -61,7 +61,7 @@ pub(super) fn check<'tcx>(
6161
let node = cx.tcx.hir_node(hir_id);
6262
if let Node::Pat(pat) = node
6363
&& let PatKind::Binding(bind_ann, ..) = pat.kind
64-
&& !matches!(bind_ann, BindingAnnotation(_, Mutability::Mut))
64+
&& !matches!(bind_ann, BindingMode(_, Mutability::Mut))
6565
&& let Node::LetStmt(parent_let_expr) = cx.tcx.parent_hir_node(hir_id)
6666
&& let Some(init) = parent_let_expr.init
6767
{

clippy_lints/src/manual_hash_one.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clippy_utils::source::snippet_opt;
44
use clippy_utils::visitors::{is_local_used, local_used_once};
55
use clippy_utils::{is_trait_method, path_to_local_id};
66
use rustc_errors::Applicability;
7-
use rustc_hir::{BindingAnnotation, ExprKind, LetStmt, Node, PatKind, StmtKind};
7+
use rustc_hir::{BindingMode, ExprKind, LetStmt, Node, PatKind, StmtKind};
88
use rustc_lint::{LateContext, LateLintPass};
99
use rustc_session::impl_lint_pass;
1010
use rustc_span::sym;
@@ -62,7 +62,7 @@ impl_lint_pass!(ManualHashOne => [MANUAL_HASH_ONE]);
6262
impl LateLintPass<'_> for ManualHashOne {
6363
fn check_local(&mut self, cx: &LateContext<'_>, local: &LetStmt<'_>) {
6464
// `let mut hasher = seg.build_hasher();`
65-
if let PatKind::Binding(BindingAnnotation::MUT, hasher, _, None) = local.pat.kind
65+
if let PatKind::Binding(BindingMode::MUT, hasher, _, None) = local.pat.kind
6666
&& let Some(init) = local.init
6767
&& !init.span.from_expansion()
6868
&& let ExprKind::MethodCall(seg, build_hasher, [], _) = init.kind

clippy_lints/src/matches/manual_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_ast::util::parser::PREC_POSTFIX;
1111
use rustc_errors::Applicability;
1212
use rustc_hir::def::Res;
1313
use rustc_hir::LangItem::{OptionNone, OptionSome};
14-
use rustc_hir::{BindingAnnotation, Expr, ExprKind, HirId, Mutability, Pat, PatKind, Path, QPath};
14+
use rustc_hir::{BindingMode, Expr, ExprKind, HirId, Mutability, Pat, PatKind, Path, QPath};
1515
use rustc_lint::LateContext;
1616
use rustc_span::{sym, SyntaxContext};
1717

@@ -139,7 +139,7 @@ where
139139
}
140140

141141
// `ref` and `ref mut` annotations were handled earlier.
142-
let annotation = if matches!(annotation, BindingAnnotation::MUT) {
142+
let annotation = if matches!(annotation, BindingMode::MUT) {
143143
"mut "
144144
} else {
145145
""

0 commit comments

Comments
 (0)