1
Fork 0

Rollup merge of #99729 - cjgillot:rm-unused-tuple, r=michaelwoerister

Remove unused tuple fields

Found by https://github.com/rust-lang/rust/pull/95977
This commit is contained in:
Matthias Krüger 2022-07-26 16:57:50 +02:00 committed by GitHub
commit ddb6a46316
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 31 deletions

View file

@ -2412,9 +2412,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
#[derive(Debug)] #[derive(Debug)]
enum SubOrigin<'hir> { enum SubOrigin<'hir> {
GAT(&'hir hir::Generics<'hir>), GAT(&'hir hir::Generics<'hir>),
Impl(&'hir hir::Generics<'hir>), Impl,
Trait(&'hir hir::Generics<'hir>), Trait,
Fn(&'hir hir::Generics<'hir>), Fn,
Unknown, Unknown,
} }
let sub_origin = 'origin: { let sub_origin = 'origin: {
@ -2429,34 +2429,30 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
kind: hir::ImplItemKind::TyAlias(..), kind: hir::ImplItemKind::TyAlias(..),
generics, generics,
.. ..
}) => SubOrigin::GAT(generics), })
Node::ImplItem(hir::ImplItem { | Node::TraitItem(hir::TraitItem {
kind: hir::ImplItemKind::Fn(..),
generics,
..
}) => SubOrigin::Fn(generics),
Node::TraitItem(hir::TraitItem {
kind: hir::TraitItemKind::Type(..), kind: hir::TraitItemKind::Type(..),
generics, generics,
.. ..
}) => SubOrigin::GAT(generics), }) => SubOrigin::GAT(generics),
Node::TraitItem(hir::TraitItem { Node::ImplItem(hir::ImplItem {
kind: hir::ImplItemKind::Fn(..),
..
})
| Node::TraitItem(hir::TraitItem {
kind: hir::TraitItemKind::Fn(..), kind: hir::TraitItemKind::Fn(..),
generics,
.. ..
}) => SubOrigin::Fn(generics), })
| Node::Item(hir::Item {
kind: hir::ItemKind::Fn(..), ..
}) => SubOrigin::Fn,
Node::Item(hir::Item { Node::Item(hir::Item {
kind: hir::ItemKind::Trait(_, _, generics, _, _), kind: hir::ItemKind::Trait(..),
.. ..
}) => SubOrigin::Trait(generics), }) => SubOrigin::Trait,
Node::Item(hir::Item { Node::Item(hir::Item {
kind: hir::ItemKind::Impl(hir::Impl { generics, .. }), kind: hir::ItemKind::Impl(..), ..
.. }) => SubOrigin::Impl,
}) => SubOrigin::Impl(generics),
Node::Item(hir::Item {
kind: hir::ItemKind::Fn(_, generics, _),
..
}) => SubOrigin::Fn(generics),
_ => continue, _ => continue,
}; };
} }

View file

@ -524,7 +524,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
let crate_root = self.r.resolve_crate_root(source.ident); let crate_root = self.r.resolve_crate_root(source.ident);
let crate_name = match crate_root.kind { let crate_name = match crate_root.kind {
ModuleKind::Def(.., name) => name, ModuleKind::Def(.., name) => name,
ModuleKind::Block(..) => unreachable!(), ModuleKind::Block => unreachable!(),
}; };
// HACK(eddyb) unclear how good this is, but keeping `$crate` // HACK(eddyb) unclear how good this is, but keeping `$crate`
// in `source` breaks `src/test/ui/imports/import-crate-var.rs`, // in `source` breaks `src/test/ui/imports/import-crate-var.rs`,
@ -936,7 +936,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
if self.block_needs_anonymous_module(block) { if self.block_needs_anonymous_module(block) {
let module = self.r.new_module( let module = self.r.new_module(
Some(parent), Some(parent),
ModuleKind::Block(block.id), ModuleKind::Block,
expansion.to_expn_id(), expansion.to_expn_id(),
block.span, block.span,
parent.no_implicit_prelude, parent.no_implicit_prelude,

View file

@ -163,7 +163,7 @@ impl<'a> Resolver<'a> {
let container = match parent.kind { let container = match parent.kind {
ModuleKind::Def(kind, _, _) => kind.descr(parent.def_id()), ModuleKind::Def(kind, _, _) => kind.descr(parent.def_id()),
ModuleKind::Block(..) => "block", ModuleKind::Block => "block",
}; };
let old_noun = match old_binding.is_import() { let old_noun = match old_binding.is_import() {

View file

@ -218,7 +218,7 @@ impl<'a> Resolver<'a> {
return Some((self.expn_def_scope(ctxt.remove_mark()), None)); return Some((self.expn_def_scope(ctxt.remove_mark()), None));
} }
if let ModuleKind::Block(..) = module.kind { if let ModuleKind::Block = module.kind {
return Some((module.parent.unwrap().nearest_item_scope(), None)); return Some((module.parent.unwrap().nearest_item_scope(), None));
} }
@ -333,7 +333,7 @@ impl<'a> Resolver<'a> {
}; };
match module.kind { match module.kind {
ModuleKind::Block(..) => {} // We can see through blocks ModuleKind::Block => {} // We can see through blocks
_ => break, _ => break,
} }

View file

@ -1444,7 +1444,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
// Items from this module // Items from this module
self.r.add_module_candidates(module, &mut names, &filter_fn); self.r.add_module_candidates(module, &mut names, &filter_fn);
if let ModuleKind::Block(..) = module.kind { if let ModuleKind::Block = module.kind {
// We can see through blocks // We can see through blocks
} else { } else {
// Items from the prelude // Items from the prelude

View file

@ -437,7 +437,7 @@ enum ModuleKind {
/// f(); // Resolves to (1) /// f(); // Resolves to (1)
/// } /// }
/// ``` /// ```
Block(NodeId), Block,
/// Any module with a name. /// Any module with a name.
/// ///
/// This could be: /// This could be:
@ -454,7 +454,7 @@ impl ModuleKind {
/// Get name of the module. /// Get name of the module.
pub fn name(&self) -> Option<Symbol> { pub fn name(&self) -> Option<Symbol> {
match self { match self {
ModuleKind::Block(..) => None, ModuleKind::Block => None,
ModuleKind::Def(.., name) => Some(*name), ModuleKind::Def(.., name) => Some(*name),
} }
} }
@ -530,7 +530,7 @@ impl<'a> ModuleData<'a> {
) -> Self { ) -> Self {
let is_foreign = match kind { let is_foreign = match kind {
ModuleKind::Def(_, def_id, _) => !def_id.is_local(), ModuleKind::Def(_, def_id, _) => !def_id.is_local(),
ModuleKind::Block(_) => false, ModuleKind::Block => false,
}; };
ModuleData { ModuleData {
parent, parent,