Skip to content

Commit efeed55

Browse files
Remove BorrowKind glob, make names longer
1 parent b14362f commit efeed55

6 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎clippy_lints/src/loops/mut_range_bound.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate<'_, 'tcx> {
8080
fnconsume(&mutself, _:&PlaceWithHirId<'tcx>, _:HirId){}
8181

8282
fnborrow(&mutself,cmt:&PlaceWithHirId<'tcx>,diag_expr_id:HirId,bk: ty::BorrowKind){
83-
if bk == ty::BorrowKind::MutBorrow{
83+
if bk == ty::BorrowKind::Mutable{
8484
ifletPlaceBase::Local(id) = cmt.place.base{
8585
ifSome(id) == self.hir_id_low && !BreakAfterExprVisitor::is_found(self.cx, diag_expr_id){
8686
self.span_low = Some(self.cx.tcx.hir().span(diag_expr_id));

‎clippy_lints/src/needless_pass_by_ref_mut.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,16 +417,16 @@ impl<'tcx> euv::Delegate<'tcx> for MutablyUsedVariablesCtxt<'tcx> {
417417
// a closure, it'll return this variant whereas if you have just an index access, it'll
418418
// return `ImmBorrow`. So if there is "Unique" and it's a mutable reference, we add it
419419
// to the mutably used variables set.
420-
if borrow == ty::BorrowKind::MutBorrow
421-
|| (borrow == ty::BorrowKind::UniqueImmBorrow && base_ty.ref_mutability() == Some(Mutability::Mut))
420+
if borrow == ty::BorrowKind::Mutable
421+
|| (borrow == ty::BorrowKind::UniqueImmutable && base_ty.ref_mutability() == Some(Mutability::Mut))
422422
{
423423
self.add_mutably_used_var(*vid);
424424
}elseifself.is_in_unsafe_block(id){
425425
// If we are in an unsafe block, any operation on this variable must not be warned
426426
// upon!
427427
self.add_mutably_used_var(*vid);
428428
}
429-
}elseif borrow == ty::ImmBorrow{
429+
}elseif borrow == ty::BorrowKind::Immutable{
430430
// If there is an `async block`, it'll contain a call to a closure which we need to
431431
// go into to ensure all "mutate" checks are found.
432432
ifletNode::Expr(Expr{

‎clippy_lints/src/operators/assign_op_pattern.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn imm_borrows_in_expr(cx: &LateContext<'_>, e: &hir::Expr<'_>) -> HirIdSet {
102102
structS(HirIdSet);
103103
implDelegate<'_>forS{
104104
fnborrow(&mutself,place:&PlaceWithHirId<'_>, _:HirId,kind:BorrowKind){
105-
ifmatches!(kind,BorrowKind::ImmBorrow | BorrowKind::UniqueImmBorrow){
105+
ifmatches!(kind,BorrowKind::Immutable | BorrowKind::UniqueImmutable){
106106
self.0.insert(match place.place.base{
107107
PlaceBase::Local(id) => id,
108108
PlaceBase::Upvar(id) => id.var_path.hir_id,
@@ -127,7 +127,7 @@ fn mut_borrows_in_expr(cx: &LateContext<'_>, e: &hir::Expr<'_>) -> HirIdSet {
127127
structS(HirIdSet);
128128
implDelegate<'_>forS{
129129
fnborrow(&mutself,place:&PlaceWithHirId<'_>, _:HirId,kind:BorrowKind){
130-
ifmatches!(kind,BorrowKind::MutBorrow){
130+
ifmatches!(kind,BorrowKind::Mutable){
131131
self.0.insert(match place.place.base{
132132
PlaceBase::Local(id) => id,
133133
PlaceBase::Upvar(id) => id.var_path.hir_id,

‎clippy_lints/src/unwrap.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ fn is_option_as_mut_use(tcx: TyCtxt<'_>, expr_id: HirId) -> bool {
217217

218218
impl<'tcx>Delegate<'tcx>forMutationVisitor<'tcx>{
219219
fnborrow(&mutself,cat:&PlaceWithHirId<'tcx>,diag_expr_id:HirId,bk: ty::BorrowKind){
220-
iflet ty::BorrowKind::MutBorrow = bk
220+
iflet ty::BorrowKind::Mutable = bk
221221
&& is_potentially_local_place(self.local_id,&cat.place)
222222
&& !is_option_as_mut_use(self.tcx, diag_expr_id)
223223
{

‎clippy_utils/src/lib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,8 +1209,8 @@ pub fn can_move_expr_to_closure<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'
12091209
let capture = match capture.info.capture_kind{
12101210
UpvarCapture::ByValue => CaptureKind::Value,
12111211
UpvarCapture::ByRef(kind) => match kind {
1212-
BorrowKind::ImmBorrow => CaptureKind::Ref(Mutability::Not),
1213-
BorrowKind::UniqueImmBorrow | BorrowKind::MutBorrow => {
1212+
BorrowKind::Immutable => CaptureKind::Ref(Mutability::Not),
1213+
BorrowKind::UniqueImmutable | BorrowKind::Mutable => {
12141214
CaptureKind::Ref(Mutability::Mut)
12151215
},
12161216
},

‎clippy_utils/src/usage.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<'tcx> Delegate<'tcx> for MutVarsDelegate {
6767
fnconsume(&mutself, _:&PlaceWithHirId<'tcx>, _:HirId){}
6868

6969
fnborrow(&mutself,cmt:&PlaceWithHirId<'tcx>, _:HirId,bk: ty::BorrowKind){
70-
if bk == ty::BorrowKind::MutBorrow{
70+
if bk == ty::BorrowKind::Mutable{
7171
self.update(cmt);
7272
}
7373
}

0 commit comments

Comments
 (0)