Skip to content

Commit 0a30fea

Browse files
committed
Address unused tuple struct fields
1 parent 16087ee commit 0a30fea

File tree

8 files changed

+11
-16
lines changed

8 files changed

+11
-16
lines changed

compiler/rustc_borrowck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct Upvar<'tcx> {
110110
}
111111

112112
/// Associate some local constants with the `'tcx` lifetime
113-
struct TyCtxtConsts<'tcx>(TyCtxt<'tcx>);
113+
struct TyCtxtConsts<'tcx>(#[allow(unused_tuple_struct_fields)] TyCtxt<'tcx>);
114114
impl<'tcx> TyCtxtConsts<'tcx> {
115115
const DEREF_PROJECTION: &'tcx [PlaceElem<'tcx>; 1] = &[ProjectionElem::Deref];
116116
}

compiler/rustc_infer/src/infer/nll_relate/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ pub trait TypeRelatingDelegate<'tcx> {
113113
fn forbid_inference_vars() -> bool;
114114
}
115115

116-
#[derive(Copy, Clone)]
117-
struct UniversallyQuantified(bool);
118-
119116
impl<'me, 'tcx, D> TypeRelating<'me, 'tcx, D>
120117
where
121118
D: TypeRelatingDelegate<'tcx>,

compiler/rustc_mir_transform/src/check_unsafety.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ pub(crate) fn provide(providers: &mut Providers) {
385385
enum Context {
386386
Safe,
387387
/// in an `unsafe fn`
388-
UnsafeFn(HirId),
388+
UnsafeFn,
389389
/// in a *used* `unsafe` block
390390
/// (i.e. a block without unused-unsafe warning)
391391
UnsafeBlock(HirId),
@@ -407,7 +407,7 @@ impl<'tcx> intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'_, 'tcx> {
407407
};
408408
let unused_unsafe = match (self.context, used) {
409409
(_, false) => UnusedUnsafe::Unused,
410-
(Context::Safe, true) | (Context::UnsafeFn(_), true) => {
410+
(Context::Safe, true) | (Context::UnsafeFn, true) => {
411411
let previous_context = self.context;
412412
self.context = Context::UnsafeBlock(block.hir_id);
413413
intravisit::walk_block(self, block);
@@ -454,7 +454,7 @@ fn check_unused_unsafe(
454454
let body = tcx.hir().body(body_id);
455455
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
456456
let context = match tcx.hir().fn_sig_by_hir_id(hir_id) {
457-
Some(sig) if sig.header.unsafety == hir::Unsafety::Unsafe => Context::UnsafeFn(hir_id),
457+
Some(sig) if sig.header.unsafety == hir::Unsafety::Unsafe => Context::UnsafeFn,
458458
_ => Context::Safe,
459459
};
460460

compiler/rustc_resolve/src/def_collector.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
218218
// ```
219219
//
220220
// In that case, the impl-trait is lowered as an additional generic parameter.
221-
self.with_impl_trait(ImplTraitContext::Universal(self.parent_def), |this| {
221+
self.with_impl_trait(ImplTraitContext::Universal, |this| {
222222
visit::walk_generic_param(this, param)
223223
});
224224
}
@@ -305,9 +305,7 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
305305
if p.is_placeholder {
306306
self.visit_macro_invoc(p.id)
307307
} else {
308-
self.with_impl_trait(ImplTraitContext::Universal(self.parent_def), |this| {
309-
visit::walk_param(this, p)
310-
})
308+
self.with_impl_trait(ImplTraitContext::Universal, |this| visit::walk_param(this, p))
311309
}
312310
}
313311

compiler/rustc_resolve/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl<'a> ParentScope<'a> {
175175
#[derive(Copy, Debug, Clone)]
176176
enum ImplTraitContext {
177177
Existential,
178-
Universal(LocalDefId),
178+
Universal,
179179
}
180180

181181
#[derive(Debug)]

library/alloc/src/boxed/thin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ struct WithHeader<H>(NonNull<u8>, PhantomData<H>);
171171
/// An opaque representation of `WithHeader<H>` to avoid the
172172
/// projection invariance of `<T as Pointee>::Metadata`.
173173
#[repr(transparent)]
174-
struct WithOpaqueHeader(NonNull<u8>);
174+
struct WithOpaqueHeader(#[allow(unused_tuple_struct_fields)] NonNull<u8>);
175175

176176
impl WithOpaqueHeader {
177177
#[cfg(not(no_global_oom_handling))]

src/librustdoc/clean/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,10 +1821,10 @@ fn maybe_expand_private_type_alias<'tcx>(
18211821
}
18221822
_ => None,
18231823
});
1824-
if let Some(ct) = const_ {
1824+
if let Some(_) = const_ {
18251825
args.insert(
18261826
param.def_id.to_def_id(),
1827-
SubstParam::Constant(clean_const(ct, cx)),
1827+
SubstParam::Constant,
18281828
);
18291829
}
18301830
// FIXME(const_generics_defaults)

src/librustdoc/clean/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,7 @@ pub(crate) enum TypeBindingKind {
25462546
pub(crate) enum SubstParam {
25472547
Type(Type),
25482548
Lifetime(Lifetime),
2549-
Constant(Constant),
2549+
Constant,
25502550
}
25512551

25522552
impl SubstParam {

0 commit comments

Comments
 (0)