diff options
| author | Jeremy Stucki <dev@jeremystucki.ch> | 2022-12-20 22:10:40 +0100 |
|---|---|---|
| committer | Jeremy Stucki <dev@jeremystucki.ch> | 2022-12-20 22:10:40 +0100 |
| commit | 3dde32ca974721daa4dfd526226d6c9e707fd8af (patch) | |
| tree | 5d6407e56538d2c5e2e0a5a8e8ed9981ec95adda /compiler/rustc_passes/src | |
| parent | 65bd2a6a73d6a74fb1266a1d96b23de8810a5fb2 (diff) | |
| download | rust-3dde32ca974721daa4dfd526226d6c9e707fd8af.tar.gz rust-3dde32ca974721daa4dfd526226d6c9e707fd8af.zip | |
rustc: Remove needless lifetimes
Diffstat (limited to 'compiler/rustc_passes/src')
| -rw-r--r-- | compiler/rustc_passes/src/dead.rs | 16 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/debugger_visualizer.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/diagnostic_items.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/layout_test.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/reachable.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/stability.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/weak_lang_items.rs | 4 |
7 files changed, 18 insertions, 26 deletions
diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index f5556738bff..edb0e4367f2 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -571,7 +571,7 @@ fn check_item<'tcx>( } } -fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx>, worklist: &mut Vec<LocalDefId>, id: hir::TraitItemId) { +fn check_trait_item(tcx: TyCtxt<'_>, worklist: &mut Vec<LocalDefId>, id: hir::TraitItemId) { use hir::TraitItemKind::{Const, Fn}; if matches!(tcx.def_kind(id.owner_id), DefKind::AssocConst | DefKind::AssocFn) { let trait_item = tcx.hir().trait_item(id); @@ -583,11 +583,7 @@ fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx>, worklist: &mut Vec<LocalDefId>, id: } } -fn check_foreign_item<'tcx>( - tcx: TyCtxt<'tcx>, - worklist: &mut Vec<LocalDefId>, - id: hir::ForeignItemId, -) { +fn check_foreign_item(tcx: TyCtxt<'_>, worklist: &mut Vec<LocalDefId>, id: hir::ForeignItemId) { if matches!(tcx.def_kind(id.owner_id), DefKind::Static(_) | DefKind::Fn) && has_allow_dead_code_or_lang_attr(tcx, id.hir_id()) { @@ -595,8 +591,8 @@ fn check_foreign_item<'tcx>( } } -fn create_and_seed_worklist<'tcx>( - tcx: TyCtxt<'tcx>, +fn create_and_seed_worklist( + tcx: TyCtxt<'_>, ) -> (Vec<LocalDefId>, FxHashMap<LocalDefId, LocalDefId>) { let effective_visibilities = &tcx.effective_visibilities(()); // see `MarkSymbolVisitor::struct_constructors` @@ -626,8 +622,8 @@ fn create_and_seed_worklist<'tcx>( (worklist, struct_constructors) } -fn live_symbols_and_ignored_derived_traits<'tcx>( - tcx: TyCtxt<'tcx>, +fn live_symbols_and_ignored_derived_traits( + tcx: TyCtxt<'_>, (): (), ) -> (FxHashSet<LocalDefId>, FxHashMap<LocalDefId, Vec<(DefId, DefId)>>) { let (worklist, struct_constructors) = create_and_seed_worklist(tcx); diff --git a/compiler/rustc_passes/src/debugger_visualizer.rs b/compiler/rustc_passes/src/debugger_visualizer.rs index 253b0a88e48..aeacbaa67cb 100644 --- a/compiler/rustc_passes/src/debugger_visualizer.rs +++ b/compiler/rustc_passes/src/debugger_visualizer.rs @@ -15,8 +15,8 @@ use std::sync::Arc; use crate::errors::DebugVisualizerUnreadable; -fn check_for_debugger_visualizer<'tcx>( - tcx: TyCtxt<'tcx>, +fn check_for_debugger_visualizer( + tcx: TyCtxt<'_>, hir_id: HirId, debugger_visualizers: &mut FxHashSet<DebuggerVisualizerFile>, ) { @@ -69,7 +69,7 @@ fn check_for_debugger_visualizer<'tcx>( } /// Traverses and collects the debugger visualizers for a specific crate. -fn debugger_visualizers<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> Vec<DebuggerVisualizerFile> { +fn debugger_visualizers(tcx: TyCtxt<'_>, cnum: CrateNum) -> Vec<DebuggerVisualizerFile> { assert_eq!(cnum, LOCAL_CRATE); // Initialize the collector. diff --git a/compiler/rustc_passes/src/diagnostic_items.rs b/compiler/rustc_passes/src/diagnostic_items.rs index a72056e00b1..10ffa87efe3 100644 --- a/compiler/rustc_passes/src/diagnostic_items.rs +++ b/compiler/rustc_passes/src/diagnostic_items.rs @@ -18,11 +18,7 @@ use rustc_span::symbol::{kw::Empty, sym, Symbol}; use crate::errors::{DuplicateDiagnosticItem, DuplicateDiagnosticItemInCrate}; -fn observe_item<'tcx>( - tcx: TyCtxt<'tcx>, - diagnostic_items: &mut DiagnosticItems, - def_id: LocalDefId, -) { +fn observe_item(tcx: TyCtxt<'_>, diagnostic_items: &mut DiagnosticItems, def_id: LocalDefId) { let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); let attrs = tcx.hir().attrs(hir_id); if let Some(name) = extract(attrs) { @@ -63,7 +59,7 @@ fn extract(attrs: &[ast::Attribute]) -> Option<Symbol> { } /// Traverse and collect the diagnostic items in the current -fn diagnostic_items<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> DiagnosticItems { +fn diagnostic_items(tcx: TyCtxt<'_>, cnum: CrateNum) -> DiagnosticItems { assert_eq!(cnum, LOCAL_CRATE); // Initialize the collector. @@ -92,7 +88,7 @@ fn diagnostic_items<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> DiagnosticItems } /// Traverse and collect all the diagnostic items in all crates. -fn all_diagnostic_items<'tcx>(tcx: TyCtxt<'tcx>, (): ()) -> DiagnosticItems { +fn all_diagnostic_items(tcx: TyCtxt<'_>, (): ()) -> DiagnosticItems { // Initialize the collector. let mut items = DiagnosticItems::default(); diff --git a/compiler/rustc_passes/src/layout_test.rs b/compiler/rustc_passes/src/layout_test.rs index 5322baee747..827d86780aa 100644 --- a/compiler/rustc_passes/src/layout_test.rs +++ b/compiler/rustc_passes/src/layout_test.rs @@ -26,7 +26,7 @@ pub fn test_layout(tcx: TyCtxt<'_>) { } } -fn dump_layout_of<'tcx>(tcx: TyCtxt<'tcx>, item_def_id: LocalDefId, attr: &Attribute) { +fn dump_layout_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId, attr: &Attribute) { let tcx = tcx; let param_env = tcx.param_env(item_def_id); let ty = tcx.type_of(item_def_id); diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs index e7c3c712852..ad095220386 100644 --- a/compiler/rustc_passes/src/reachable.rs +++ b/compiler/rustc_passes/src/reachable.rs @@ -347,7 +347,7 @@ fn check_item<'tcx>( } } -fn has_custom_linkage<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> bool { +fn has_custom_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { // Anything which has custom linkage gets thrown on the worklist no // matter where it is in the crate, along with "special std symbols" // which are currently akin to allocator symbols. @@ -364,7 +364,7 @@ fn has_custom_linkage<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> bool { || codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER) } -fn reachable_set<'tcx>(tcx: TyCtxt<'tcx>, (): ()) -> FxHashSet<LocalDefId> { +fn reachable_set(tcx: TyCtxt<'_>, (): ()) -> FxHashSet<LocalDefId> { let effective_visibilities = &tcx.effective_visibilities(()); let any_library = diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index da715523474..96f7236de5c 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -853,7 +853,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> { /// Check whether a path is a `use` item that has been marked as unstable. /// /// See issue #94972 for details on why this is a special case -fn is_unstable_reexport<'tcx>(tcx: TyCtxt<'tcx>, id: hir::HirId) -> bool { +fn is_unstable_reexport(tcx: TyCtxt<'_>, id: hir::HirId) -> bool { // Get the LocalDefId so we can lookup the item to check the kind. let Some(def_id) = tcx.hir().opt_local_def_id(id) else { return false; }; diff --git a/compiler/rustc_passes/src/weak_lang_items.rs b/compiler/rustc_passes/src/weak_lang_items.rs index f0815fcd8db..fc6372cf99e 100644 --- a/compiler/rustc_passes/src/weak_lang_items.rs +++ b/compiler/rustc_passes/src/weak_lang_items.rs @@ -11,7 +11,7 @@ use crate::errors::{MissingLangItem, MissingPanicHandler, UnknownExternLangItem} /// Checks the crate for usage of weak lang items, returning a vector of all the /// language items required by this crate, but not defined yet. -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>, items: &mut lang_items::LanguageItems) { +pub fn check_crate(tcx: TyCtxt<'_>, items: &mut lang_items::LanguageItems) { // These are never called by user code, they're generated by the compiler. // They will never implicitly be added to the `missing` array unless we do // so here. @@ -40,7 +40,7 @@ pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>, items: &mut lang_items::LanguageItem verify(tcx, items); } -fn verify<'tcx>(tcx: TyCtxt<'tcx>, items: &lang_items::LanguageItems) { +fn verify(tcx: TyCtxt<'_>, items: &lang_items::LanguageItems) { // We only need to check for the presence of weak lang items if we're // emitting something that's not an rlib. let needs_check = tcx.sess.crate_types().iter().any(|kind| match *kind { |
