Skip to content

Commit ddb6a46

Browse files
authored
Rollup merge of #99729 - cjgillot:rm-unused-tuple, r=michaelwoerister
Remove unused tuple fields Found by #95977
2 parents dfaf6ec + 9450f82 commit ddb6a46

File tree

6 files changed

+27
-31
lines changed

6 files changed

+27
-31
lines changed

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

+18-22
Original file line numberDiff line numberDiff line change
@@ -2412,9 +2412,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
24122412
#[derive(Debug)]
24132413
enum SubOrigin<'hir> {
24142414
GAT(&'hir hir::Generics<'hir>),
2415-
Impl(&'hir hir::Generics<'hir>),
2416-
Trait(&'hir hir::Generics<'hir>),
2417-
Fn(&'hir hir::Generics<'hir>),
2415+
Impl,
2416+
Trait,
2417+
Fn,
24182418
Unknown,
24192419
}
24202420
let sub_origin = 'origin: {
@@ -2429,34 +2429,30 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
24292429
kind: hir::ImplItemKind::TyAlias(..),
24302430
generics,
24312431
..
2432-
}) => SubOrigin::GAT(generics),
2433-
Node::ImplItem(hir::ImplItem {
2434-
kind: hir::ImplItemKind::Fn(..),
2435-
generics,
2436-
..
2437-
}) => SubOrigin::Fn(generics),
2438-
Node::TraitItem(hir::TraitItem {
2432+
})
2433+
| Node::TraitItem(hir::TraitItem {
24392434
kind: hir::TraitItemKind::Type(..),
24402435
generics,
24412436
..
24422437
}) => SubOrigin::GAT(generics),
2443-
Node::TraitItem(hir::TraitItem {
2444-
kind: hir::TraitItemKind::Fn(..),
2445-
generics,
2438+
Node::ImplItem(hir::ImplItem {
2439+
kind: hir::ImplItemKind::Fn(..),
24462440
..
2447-
}) => SubOrigin::Fn(generics),
2448-
Node::Item(hir::Item {
2449-
kind: hir::ItemKind::Trait(_, _, generics, _, _),
2441+
})
2442+
| Node::TraitItem(hir::TraitItem {
2443+
kind: hir::TraitItemKind::Fn(..),
24502444
..
2451-
}) => SubOrigin::Trait(generics),
2445+
})
2446+
| Node::Item(hir::Item {
2447+
kind: hir::ItemKind::Fn(..), ..
2448+
}) => SubOrigin::Fn,
24522449
Node::Item(hir::Item {
2453-
kind: hir::ItemKind::Impl(hir::Impl { generics, .. }),
2450+
kind: hir::ItemKind::Trait(..),
24542451
..
2455-
}) => SubOrigin::Impl(generics),
2452+
}) => SubOrigin::Trait,
24562453
Node::Item(hir::Item {
2457-
kind: hir::ItemKind::Fn(_, generics, _),
2458-
..
2459-
}) => SubOrigin::Fn(generics),
2454+
kind: hir::ItemKind::Impl(..), ..
2455+
}) => SubOrigin::Impl,
24602456
_ => continue,
24612457
};
24622458
}

compiler/rustc_resolve/src/build_reduced_graph.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
524524
let crate_root = self.r.resolve_crate_root(source.ident);
525525
let crate_name = match crate_root.kind {
526526
ModuleKind::Def(.., name) => name,
527-
ModuleKind::Block(..) => unreachable!(),
527+
ModuleKind::Block => unreachable!(),
528528
};
529529
// HACK(eddyb) unclear how good this is, but keeping `$crate`
530530
// in `source` breaks `src/test/ui/imports/import-crate-var.rs`,
@@ -936,7 +936,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
936936
if self.block_needs_anonymous_module(block) {
937937
let module = self.r.new_module(
938938
Some(parent),
939-
ModuleKind::Block(block.id),
939+
ModuleKind::Block,
940940
expansion.to_expn_id(),
941941
block.span,
942942
parent.no_implicit_prelude,

compiler/rustc_resolve/src/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl<'a> Resolver<'a> {
163163

164164
let container = match parent.kind {
165165
ModuleKind::Def(kind, _, _) => kind.descr(parent.def_id()),
166-
ModuleKind::Block(..) => "block",
166+
ModuleKind::Block => "block",
167167
};
168168

169169
let old_noun = match old_binding.is_import() {

compiler/rustc_resolve/src/ident.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl<'a> Resolver<'a> {
218218
return Some((self.expn_def_scope(ctxt.remove_mark()), None));
219219
}
220220

221-
if let ModuleKind::Block(..) = module.kind {
221+
if let ModuleKind::Block = module.kind {
222222
return Some((module.parent.unwrap().nearest_item_scope(), None));
223223
}
224224

@@ -333,7 +333,7 @@ impl<'a> Resolver<'a> {
333333
};
334334

335335
match module.kind {
336-
ModuleKind::Block(..) => {} // We can see through blocks
336+
ModuleKind::Block => {} // We can see through blocks
337337
_ => break,
338338
}
339339

compiler/rustc_resolve/src/late/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
14441444
// Items from this module
14451445
self.r.add_module_candidates(module, &mut names, &filter_fn);
14461446

1447-
if let ModuleKind::Block(..) = module.kind {
1447+
if let ModuleKind::Block = module.kind {
14481448
// We can see through blocks
14491449
} else {
14501450
// Items from the prelude

compiler/rustc_resolve/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ enum ModuleKind {
437437
/// f(); // Resolves to (1)
438438
/// }
439439
/// ```
440-
Block(NodeId),
440+
Block,
441441
/// Any module with a name.
442442
///
443443
/// This could be:
@@ -454,7 +454,7 @@ impl ModuleKind {
454454
/// Get name of the module.
455455
pub fn name(&self) -> Option<Symbol> {
456456
match self {
457-
ModuleKind::Block(..) => None,
457+
ModuleKind::Block => None,
458458
ModuleKind::Def(.., name) => Some(*name),
459459
}
460460
}
@@ -530,7 +530,7 @@ impl<'a> ModuleData<'a> {
530530
) -> Self {
531531
let is_foreign = match kind {
532532
ModuleKind::Def(_, def_id, _) => !def_id.is_local(),
533-
ModuleKind::Block(_) => false,
533+
ModuleKind::Block => false,
534534
};
535535
ModuleData {
536536
parent,

0 commit comments

Comments
 (0)