Skip to content

Commit 1a2f79b

Browse files
authoredDec 3, 2022
Rollup merge of #105050 - WaffleLapkin:uselessrefign, r=jyn514
Remove useless borrows and derefs They are nothing more than noise. <sub>These are not all of them, but my clippy started crashing (stack overflow), so rip :(</sub>
2 parents c89bff2 + 083ef45 commit 1a2f79b

Some content is hidden

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

42 files changed

+157
-158
lines changed
 

‎compiler/rustc_abi/src/layout.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ pub trait LayoutCalculator {
354354
if !always_sized { StructKind::MaybeUnsized } else { StructKind::AlwaysSized }
355355
};
356356

357-
let mut st = self.univariant(dl, &variants[v], &repr, kind)?;
357+
let mut st = self.univariant(dl, &variants[v], repr, kind)?;
358358
st.variants = Variants::Single { index: v };
359359

360360
if is_unsafe_cell {
@@ -457,7 +457,7 @@ pub trait LayoutCalculator {
457457
let mut variant_layouts = variants
458458
.iter_enumerated()
459459
.map(|(j, v)| {
460-
let mut st = self.univariant(dl, v, &repr, StructKind::AlwaysSized)?;
460+
let mut st = self.univariant(dl, v, repr, StructKind::AlwaysSized)?;
461461
st.variants = Variants::Single { index: j };
462462

463463
align = align.max(st.align);
@@ -647,8 +647,8 @@ pub trait LayoutCalculator {
647647
.map(|(i, field_layouts)| {
648648
let mut st = self.univariant(
649649
dl,
650-
&field_layouts,
651-
&repr,
650+
field_layouts,
651+
repr,
652652
StructKind::Prefixed(min_ity.size(), prefix_align),
653653
)?;
654654
st.variants = Variants::Single { index: i };
@@ -755,7 +755,7 @@ pub trait LayoutCalculator {
755755
// Try to use a ScalarPair for all tagged enums.
756756
let mut common_prim = None;
757757
let mut common_prim_initialized_in_all_variants = true;
758-
for (field_layouts, layout_variant) in iter::zip(&*variants, &layout_variants) {
758+
for (field_layouts, layout_variant) in iter::zip(variants, &layout_variants) {
759759
let FieldsShape::Arbitrary { ref offsets, .. } = layout_variant.fields else {
760760
panic!();
761761
};

‎compiler/rustc_ast/src/ast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ impl Expr {
11791179
pub fn peel_parens(&self) -> &Expr {
11801180
let mut expr = self;
11811181
while let ExprKind::Paren(inner) = &expr.kind {
1182-
expr = &inner;
1182+
expr = inner;
11831183
}
11841184
expr
11851185
}
@@ -2029,7 +2029,7 @@ impl Ty {
20292029
pub fn peel_refs(&self) -> &Self {
20302030
let mut final_ty = self;
20312031
while let TyKind::Rptr(_, MutTy { ty, .. }) = &final_ty.kind {
2032-
final_ty = &ty;
2032+
final_ty = ty;
20332033
}
20342034
final_ty
20352035
}

0 commit comments

Comments
 (0)
Please sign in to comment.