From ec711767a7ac6911faae85d4b9285d07d5ebf949 Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Fri, 21 Jun 2019 20:27:44 +0200 Subject: [PATCH] Remove needless lifetimes --- src/librustc_borrowck/dataflow.rs | 6 +- src/librustc_codegen_llvm/base.rs | 4 +- src/librustc_codegen_llvm/builder.rs | 2 +- src/librustc_codegen_llvm/lib.rs | 2 +- src/librustc_codegen_ssa/base.rs | 2 +- .../symbol_names_test.rs | 2 +- src/librustc_data_structures/bit_set.rs | 4 +- src/librustc_data_structures/fingerprint.rs | 2 +- src/librustc_driver/pretty.rs | 20 ++--- src/librustc_errors/emitter.rs | 2 +- src/librustc_errors/lib.rs | 84 +++++++++---------- src/librustc_incremental/assert_dep_graph.rs | 2 +- .../assert_module_sources.rs | 2 +- src/librustc_interface/passes.rs | 6 +- src/librustc_interface/proc_macro_decls.rs | 4 +- src/librustc_lint/lib.rs | 2 +- src/librustc_metadata/cstore_impl.rs | 4 +- src/librustc_metadata/encoder.rs | 4 +- src/librustc_metadata/foreign_modules.rs | 2 +- src/librustc_metadata/link_args.rs | 2 +- src/librustc_metadata/native_libs.rs | 2 +- src/librustc_mir/shim.rs | 2 +- src/librustc_passes/hir_stats.rs | 2 +- src/librustc_passes/layout_test.rs | 2 +- src/librustc_passes/loops.rs | 2 +- src/librustc_passes/rvalue_promotion.rs | 4 +- src/librustc_plugin/build.rs | 4 +- src/librustc_plugin/registry.rs | 2 +- src/librustc_privacy/lib.rs | 20 ++--- 29 files changed, 99 insertions(+), 99 deletions(-) diff --git a/src/librustc_borrowck/dataflow.rs b/src/librustc_borrowck/dataflow.rs index f5d311b35d7..dc7014d22ec 100644 --- a/src/librustc_borrowck/dataflow.rs +++ b/src/librustc_borrowck/dataflow.rs @@ -84,9 +84,9 @@ struct PropagationContext<'a, 'tcx, O> { changed: bool, } -fn get_cfg_indices<'a>(id: hir::ItemLocalId, - index: &'a FxHashMap>) - -> &'a [CFGIndex] { +fn get_cfg_indices(id: hir::ItemLocalId, + index: &FxHashMap>) + -> &[CFGIndex] { index.get(&id).map_or(&[], |v| &v[..]) } diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index 04645dacfec..21c19e167cf 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -123,8 +123,8 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'tcx>, cgu_name: InternedString) { submit_codegened_module_to_llvm(&LlvmCodegenBackend(()), tcx, module, cost); - fn module_codegen<'tcx>( - tcx: TyCtxt<'tcx>, + fn module_codegen( + tcx: TyCtxt<'_>, cgu_name: InternedString, ) -> ModuleCodegen { let cgu = tcx.codegen_unit(cgu_name); diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index 0709368ad86..f67c740b777 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -144,7 +144,7 @@ fn with_cx(cx: &'a CodegenCx<'ll, 'tcx>) -> Self { } } - fn build_sibling_block<'b>(&self, name: &'b str) -> Self { + fn build_sibling_block(&self, name: &str) -> Self { Builder::new_block(self.cx, self.llfn(), name) } diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 7283aa95b30..e6630e18165 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -124,7 +124,7 @@ fn codegen_allocator<'tcx>( ) { unsafe { allocator::codegen(tcx, mods, kind) } } - fn compile_codegen_unit<'tcx>(&self, tcx: TyCtxt<'tcx>, cgu_name: InternedString) { + fn compile_codegen_unit(&self, tcx: TyCtxt<'_>, cgu_name: InternedString) { base::compile_codegen_unit(tcx, cgu_name); } fn target_machine_factory( diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index 47b383fddbc..d06460fc856 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -700,7 +700,7 @@ fn drop(&mut self) { } } -fn assert_and_save_dep_graph<'tcx>(tcx: TyCtxt<'tcx>) { +fn assert_and_save_dep_graph(tcx: TyCtxt<'_>) { time(tcx.sess, "assert dep graph", || ::rustc_incremental::assert_dep_graph(tcx)); diff --git a/src/librustc_codegen_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs index f48d1f2853c..7ab29c5c4c3 100644 --- a/src/librustc_codegen_utils/symbol_names_test.rs +++ b/src/librustc_codegen_utils/symbol_names_test.rs @@ -11,7 +11,7 @@ const SYMBOL_NAME: Symbol = sym::rustc_symbol_name; const DEF_PATH: Symbol = sym::rustc_def_path; -pub fn report_symbol_names<'tcx>(tcx: TyCtxt<'tcx>) { +pub fn report_symbol_names(tcx: TyCtxt<'_>) { // if the `rustc_attrs` feature is not enabled, then the // attributes we are interested in cannot be present anyway, so // skip the walk. diff --git a/src/librustc_data_structures/bit_set.rs b/src/librustc_data_structures/bit_set.rs index 5d8388d89f5..1eb28bccbe3 100644 --- a/src/librustc_data_structures/bit_set.rs +++ b/src/librustc_data_structures/bit_set.rs @@ -168,7 +168,7 @@ pub fn words(&self) -> &[Word] { /// Iterates over the indices of set bits in a sorted order. #[inline] - pub fn iter<'a>(&'a self) -> BitIter<'a, T> { + pub fn iter(&self) -> BitIter<'_, T> { BitIter { cur: None, iter: self.words.iter().enumerate(), @@ -849,7 +849,7 @@ pub fn words(&self) -> &[Word] { /// Iterates through all the columns set to true in a given row of /// the matrix. - pub fn iter<'a>(&'a self, row: R) -> BitIter<'a, C> { + pub fn iter(&self, row: R) -> BitIter<'_, C> { assert!(row.index() < self.num_rows); let (start, end) = self.range(row); BitIter { diff --git a/src/librustc_data_structures/fingerprint.rs b/src/librustc_data_structures/fingerprint.rs index 7975c62b90f..3bea965ef30 100644 --- a/src/librustc_data_structures/fingerprint.rs +++ b/src/librustc_data_structures/fingerprint.rs @@ -58,7 +58,7 @@ pub fn encode_opaque(&self, encoder: &mut Encoder) -> EncodeResult { Ok(()) } - pub fn decode_opaque<'a>(decoder: &mut Decoder<'a>) -> Result { + pub fn decode_opaque(decoder: &mut Decoder<'_>) -> Result { let mut bytes = [0; 16]; decoder.read_raw_bytes(&mut bytes)?; diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index d92f3aafa1c..ff0c4ff548b 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -188,7 +188,7 @@ fn call_with_pp_support<'tcx, A, F>( _ => panic!("Should use call_with_pp_support_hir"), } } - fn call_with_pp_support_hir<'tcx, A, F>(&self, tcx: TyCtxt<'tcx>, f: F) -> A + fn call_with_pp_support_hir(&self, tcx: TyCtxt<'_>, f: F) -> A where F: FnOnce(&dyn HirPrinterSupport<'_>, &hir::Crate) -> A, { @@ -228,7 +228,7 @@ fn call_with_pp_support_hir<'tcx, A, F>(&self, tcx: TyCtxt<'tcx>, f: F) -> A trait PrinterSupport: pprust::PpAnn { /// Provides a uniform interface for re-extracting a reference to a /// `Session` from a value that now owns it. - fn sess<'a>(&'a self) -> &'a Session; + fn sess(&self) -> &Session; /// Produces the pretty-print annotation object. /// @@ -240,7 +240,7 @@ trait PrinterSupport: pprust::PpAnn { trait HirPrinterSupport<'hir>: pprust_hir::PpAnn { /// Provides a uniform interface for re-extracting a reference to a /// `Session` from a value that now owns it. - fn sess<'a>(&'a self) -> &'a Session; + fn sess(&self) -> &Session; /// Provides a uniform interface for re-extracting a reference to an /// `hir_map::Map` from a value that now owns it. @@ -272,7 +272,7 @@ struct NoAnn<'hir> { } impl<'hir> PrinterSupport for NoAnn<'hir> { - fn sess<'a>(&'a self) -> &'a Session { + fn sess(&self) -> &Session { self.sess } @@ -282,7 +282,7 @@ fn pp_ann<'a>(&'a self) -> &'a dyn pprust::PpAnn { } impl<'hir> HirPrinterSupport<'hir> for NoAnn<'hir> { - fn sess<'a>(&'a self) -> &'a Session { + fn sess(&self) -> &Session { self.sess } @@ -313,7 +313,7 @@ struct IdentifiedAnnotation<'hir> { } impl<'hir> PrinterSupport for IdentifiedAnnotation<'hir> { - fn sess<'a>(&'a self) -> &'a Session { + fn sess(&self) -> &Session { self.sess } @@ -360,7 +360,7 @@ fn post(&self, s: &mut pprust::State<'_>, node: pprust::AnnNode<'_>) -> io::Resu } impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> { - fn sess<'a>(&'a self) -> &'a Session { + fn sess(&self) -> &Session { self.sess } @@ -458,7 +458,7 @@ struct TypedAnnotation<'a, 'tcx> { } impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> { - fn sess<'a>(&'a self) -> &'a Session { + fn sess(&self) -> &Session { &self.tcx.sess } @@ -866,8 +866,8 @@ pub fn print_after_hir_lowering<'tcx>( // analysis is performed. However, we want to call `phase_3_run_analysis_passes` // with a different callback than the standard driver, so that isn't easy. // Instead, we call that function ourselves. -fn print_with_analysis<'tcx>( - tcx: TyCtxt<'tcx>, +fn print_with_analysis( + tcx: TyCtxt<'_>, ppm: PpMode, uii: Option, ofile: Option<&Path>, diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index a2717ab7ad8..83a0fb486fd 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1635,7 +1635,7 @@ fn from_stderr(color: ColorConfig) -> Destination { } } - fn writable<'a>(&'a mut self) -> WritableDst<'a> { + fn writable(&mut self) -> WritableDst<'_> { match *self { Destination::Terminal(ref mut t) => WritableDst::Terminal(t), Destination::Buffered(ref mut t) => { diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 70bd25a9d57..1ffee1cdf69 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -438,14 +438,14 @@ pub fn reset_err_count(&self) { self.err_count.store(0, SeqCst); } - pub fn struct_dummy<'a>(&'a self) -> DiagnosticBuilder<'a> { + pub fn struct_dummy(&self) -> DiagnosticBuilder<'_> { DiagnosticBuilder::new(self, Level::Cancelled, "") } - pub fn struct_span_warn<'a, S: Into>(&'a self, - sp: S, - msg: &str) - -> DiagnosticBuilder<'a> { + pub fn struct_span_warn>(&self, + sp: S, + msg: &str) + -> DiagnosticBuilder<'_> { let mut result = DiagnosticBuilder::new(self, Level::Warning, msg); result.set_span(sp); if !self.flags.can_emit_warnings { @@ -453,11 +453,11 @@ pub fn struct_span_warn<'a, S: Into>(&'a self, } result } - pub fn struct_span_warn_with_code<'a, S: Into>(&'a self, - sp: S, - msg: &str, - code: DiagnosticId) - -> DiagnosticBuilder<'a> { + pub fn struct_span_warn_with_code>(&self, + sp: S, + msg: &str, + code: DiagnosticId) + -> DiagnosticBuilder<'_> { let mut result = DiagnosticBuilder::new(self, Level::Warning, msg); result.set_span(sp); result.code(code); @@ -466,63 +466,63 @@ pub fn struct_span_warn_with_code<'a, S: Into>(&'a self, } result } - pub fn struct_warn<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> { + pub fn struct_warn(&self, msg: &str) -> DiagnosticBuilder<'_> { let mut result = DiagnosticBuilder::new(self, Level::Warning, msg); if !self.flags.can_emit_warnings { result.cancel(); } result } - pub fn struct_span_err<'a, S: Into>(&'a self, - sp: S, - msg: &str) - -> DiagnosticBuilder<'a> { + pub fn struct_span_err>(&self, + sp: S, + msg: &str) + -> DiagnosticBuilder<'_> { let mut result = DiagnosticBuilder::new(self, Level::Error, msg); result.set_span(sp); result } - pub fn struct_span_err_with_code<'a, S: Into>(&'a self, - sp: S, - msg: &str, - code: DiagnosticId) - -> DiagnosticBuilder<'a> { + pub fn struct_span_err_with_code>(&self, + sp: S, + msg: &str, + code: DiagnosticId) + -> DiagnosticBuilder<'_> { let mut result = DiagnosticBuilder::new(self, Level::Error, msg); result.set_span(sp); result.code(code); result } // FIXME: This method should be removed (every error should have an associated error code). - pub fn struct_err<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> { + pub fn struct_err(&self, msg: &str) -> DiagnosticBuilder<'_> { DiagnosticBuilder::new(self, Level::Error, msg) } - pub fn struct_err_with_code<'a>( - &'a self, + pub fn struct_err_with_code( + &self, msg: &str, code: DiagnosticId, - ) -> DiagnosticBuilder<'a> { + ) -> DiagnosticBuilder<'_> { let mut result = DiagnosticBuilder::new(self, Level::Error, msg); result.code(code); result } - pub fn struct_span_fatal<'a, S: Into>(&'a self, - sp: S, - msg: &str) - -> DiagnosticBuilder<'a> { + pub fn struct_span_fatal>(&self, + sp: S, + msg: &str) + -> DiagnosticBuilder<'_> { let mut result = DiagnosticBuilder::new(self, Level::Fatal, msg); result.set_span(sp); result } - pub fn struct_span_fatal_with_code<'a, S: Into>(&'a self, - sp: S, - msg: &str, - code: DiagnosticId) - -> DiagnosticBuilder<'a> { + pub fn struct_span_fatal_with_code>(&self, + sp: S, + msg: &str, + code: DiagnosticId) + -> DiagnosticBuilder<'_> { let mut result = DiagnosticBuilder::new(self, Level::Fatal, msg); result.set_span(sp); result.code(code); result } - pub fn struct_fatal<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> { + pub fn struct_fatal(&self, msg: &str) -> DiagnosticBuilder<'_> { DiagnosticBuilder::new(self, Level::Fatal, msg) } @@ -563,10 +563,10 @@ pub fn span_fatal_with_code>(&self, pub fn span_err>(&self, sp: S, msg: &str) { self.emit(&sp.into(), msg, Error); } - pub fn mut_span_err<'a, S: Into>(&'a self, - sp: S, - msg: &str) - -> DiagnosticBuilder<'a> { + pub fn mut_span_err>(&self, + sp: S, + msg: &str) + -> DiagnosticBuilder<'_> { let mut result = DiagnosticBuilder::new(self, Level::Error, msg); result.set_span(sp); result @@ -605,10 +605,10 @@ pub fn span_bug_no_panic>(&self, sp: S, msg: &str) { pub fn span_note_without_error>(&self, sp: S, msg: &str) { self.emit(&sp.into(), msg, Note); } - pub fn span_note_diag<'a>(&'a self, - sp: Span, - msg: &str) - -> DiagnosticBuilder<'a> { + pub fn span_note_diag(&self, + sp: Span, + msg: &str) + -> DiagnosticBuilder<'_> { let mut db = DiagnosticBuilder::new(self, Note, msg); db.set_span(sp); db diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index a43347a2197..38dc6edaf63 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -51,7 +51,7 @@ use syntax::ast; use syntax_pos::Span; -pub fn assert_dep_graph<'tcx>(tcx: TyCtxt<'tcx>) { +pub fn assert_dep_graph(tcx: TyCtxt<'_>) { tcx.dep_graph.with_ignore(|| { if tcx.sess.opts.debugging_opts.dump_dep_graph { dump_graph(tcx); diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index f502d047546..046fdc72270 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -35,7 +35,7 @@ const CFG: Symbol = sym::cfg; const KIND: Symbol = sym::kind; -pub fn assert_module_sources<'tcx>(tcx: TyCtxt<'tcx>) { +pub fn assert_module_sources(tcx: TyCtxt<'_>) { tcx.dep_graph.with_ignore(|| { if tcx.sess.opts.incremental.is_none() { return; diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index c1b6e3409c9..d6987281981 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -878,7 +878,7 @@ pub fn create_global_ctxt( /// Runs the resolution, type-checking, region checking and other /// miscellaneous analysis passes on the crate. -fn analysis<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> Result<()> { +fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> { assert_eq!(cnum, LOCAL_CRATE); let sess = tcx.sess; @@ -995,8 +995,8 @@ fn analysis<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> Result<()> { Ok(()) } -fn encode_and_write_metadata<'tcx>( - tcx: TyCtxt<'tcx>, +fn encode_and_write_metadata( + tcx: TyCtxt<'_>, outputs: &OutputFilenames, ) -> (middle::cstore::EncodedMetadata, bool) { #[derive(PartialEq, Eq, PartialOrd, Ord)] diff --git a/src/librustc_interface/proc_macro_decls.rs b/src/librustc_interface/proc_macro_decls.rs index 9e1ef6b022d..d888c9e57d3 100644 --- a/src/librustc_interface/proc_macro_decls.rs +++ b/src/librustc_interface/proc_macro_decls.rs @@ -6,11 +6,11 @@ use syntax::attr; use syntax::symbol::sym; -pub fn find<'tcx>(tcx: TyCtxt<'tcx>) -> Option { +pub fn find(tcx: TyCtxt<'_>) -> Option { tcx.proc_macro_decls_static(LOCAL_CRATE) } -fn proc_macro_decls_static<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> Option { +fn proc_macro_decls_static(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option { assert_eq!(cnum, LOCAL_CRATE); let mut finder = Finder { decls: None }; diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index d808a15982e..4c6ceb14ca4 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -74,7 +74,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn lint_mod<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) { +fn lint_mod(tcx: TyCtxt<'_>, module_def_id: DefId) { lint::late_lint_mod(tcx, module_def_id, BuiltinCombinedModuleLateLintPass::new()); } diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 04a9c4e9a1a..914084d7e9e 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -250,7 +250,7 @@ fn into_args(self) -> (DefId, DefId) { (self.0.as_def_id(), self.1) } exported_symbols => { Arc::new(cdata.exported_symbols(tcx)) } } -pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { +pub fn provide(providers: &mut Providers<'_>) { // FIXME(#44234) - almost all of these queries have no sub-queries and // therefore no actual inputs, they're just reading tables calculated in // resolve! Does this work? Unsure! That's what the issue is about @@ -550,7 +550,7 @@ fn postorder_cnums_untracked(&self) -> Vec { self.do_postorder_cnums_untracked() } - fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx>) -> EncodedMetadata { + fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata { encoder::encode_metadata(tcx) } diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index b52b6dfbb5e..73c20ccad5a 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1863,7 +1863,7 @@ fn visit_impl_item(&mut self, _impl_item: &'v hir::ImplItem) { // will allow us to slice the metadata to the precise length that we just // generated regardless of trailing bytes that end up in it. -pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx>) -> EncodedMetadata { +pub fn encode_metadata(tcx: TyCtxt<'_>) -> EncodedMetadata { let mut encoder = opaque::Encoder::new(vec![]); encoder.emit_raw_bytes(METADATA_HEADER); @@ -1905,7 +1905,7 @@ pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx>) -> EncodedMetadata { EncodedMetadata { raw_data: result } } -pub fn get_repr_options<'tcx>(tcx: TyCtxt<'tcx>, did: DefId) -> ReprOptions { +pub fn get_repr_options(tcx: TyCtxt<'_>, did: DefId) -> ReprOptions { let ty = tcx.type_of(did); match ty.sty { ty::Adt(ref def, _) => return def.repr, diff --git a/src/librustc_metadata/foreign_modules.rs b/src/librustc_metadata/foreign_modules.rs index 0ce103cfa40..b1f4dfffc78 100644 --- a/src/librustc_metadata/foreign_modules.rs +++ b/src/librustc_metadata/foreign_modules.rs @@ -3,7 +3,7 @@ use rustc::middle::cstore::ForeignModule; use rustc::ty::TyCtxt; -pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> Vec { +pub fn collect(tcx: TyCtxt<'_>) -> Vec { let mut collector = Collector { tcx, modules: Vec::new(), diff --git a/src/librustc_metadata/link_args.rs b/src/librustc_metadata/link_args.rs index cd6270046fa..728fd004fcb 100644 --- a/src/librustc_metadata/link_args.rs +++ b/src/librustc_metadata/link_args.rs @@ -4,7 +4,7 @@ use rustc_target::spec::abi::Abi; use syntax::symbol::sym; -pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> Vec { +pub fn collect(tcx: TyCtxt<'_>) -> Vec { let mut collector = Collector { args: Vec::new(), }; diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index 7b335b3b483..4a01d0e559a 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -11,7 +11,7 @@ use syntax::symbol::{Symbol, sym}; use syntax::{span_err, struct_span_err}; -pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> Vec { +pub fn collect(tcx: TyCtxt<'_>) -> Vec { let mut collector = Collector { tcx, libs: Vec::new(), diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 7987095a334..32b964dbadf 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -829,7 +829,7 @@ fn build_call_shim<'tcx>( body } -pub fn build_adt_ctor<'tcx>(tcx: TyCtxt<'tcx>, ctor_id: DefId) -> &'tcx Body<'tcx> { +pub fn build_adt_ctor(tcx: TyCtxt<'_>, ctor_id: DefId) -> &Body<'_> { debug_assert!(tcx.is_constructor(ctor_id)); let span = tcx.hir().span_if_local(ctor_id) diff --git a/src/librustc_passes/hir_stats.rs b/src/librustc_passes/hir_stats.rs index 6936aedb9de..e7f6abc410a 100644 --- a/src/librustc_passes/hir_stats.rs +++ b/src/librustc_passes/hir_stats.rs @@ -38,7 +38,7 @@ pub fn print_hir_stats(krate: &hir::Crate) { collector.print("HIR STATS"); } -pub fn print_ast_stats<'v>(krate: &'v ast::Crate, title: &str) { +pub fn print_ast_stats(krate: &ast::Crate, title: &str) { let mut collector = StatCollector { krate: None, data: FxHashMap::default(), diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs index 8f790d13285..6b1ce578240 100644 --- a/src/librustc_passes/layout_test.rs +++ b/src/librustc_passes/layout_test.rs @@ -14,7 +14,7 @@ use syntax::ast::Attribute; use syntax::symbol::sym; -pub fn test_layout<'tcx>(tcx: TyCtxt<'tcx>) { +pub fn test_layout(tcx: TyCtxt<'_>) { if tcx.features().rustc_attrs { // if the `rustc_attrs` feature is not enabled, don't bother testing layout tcx.hir() diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index ed0a78b4652..616e6974110 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -45,7 +45,7 @@ struct CheckLoopVisitor<'a, 'hir> { cx: Context, } -fn check_mod_loops<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) { +fn check_mod_loops(tcx: TyCtxt<'_>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckLoopVisitor { sess: &tcx.sess, hir_map: &tcx.hir(), diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index bc1151974bb..e14fa07fbbf 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -39,7 +39,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool { +fn const_is_rvalue_promotable_to_static(tcx: TyCtxt<'_>, def_id: DefId) -> bool { assert!(def_id.is_local()); let hir_id = tcx.hir().as_local_hir_id(def_id) @@ -48,7 +48,7 @@ fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) tcx.rvalue_promotable_map(def_id).contains(&body_id.hir_id.local_id) } -fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ItemLocalSet { +fn rvalue_promotable_map(tcx: TyCtxt<'_>, def_id: DefId) -> &ItemLocalSet { let outer_def_id = tcx.closure_base_def_id(def_id); if outer_def_id != def_id { return tcx.rvalue_promotable_map(outer_def_id); diff --git a/src/librustc_plugin/build.rs b/src/librustc_plugin/build.rs index d3ac597160f..816e283a104 100644 --- a/src/librustc_plugin/build.rs +++ b/src/librustc_plugin/build.rs @@ -30,11 +30,11 @@ fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) { } /// Finds the function marked with `#[plugin_registrar]`, if any. -pub fn find_plugin_registrar<'tcx>(tcx: TyCtxt<'tcx>) -> Option { +pub fn find_plugin_registrar(tcx: TyCtxt<'_>) -> Option { tcx.plugin_registrar_fn(LOCAL_CRATE) } -fn plugin_registrar_fn<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> Option { +fn plugin_registrar_fn(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option { assert_eq!(cnum, LOCAL_CRATE); let mut finder = RegistrarFinder { registrars: Vec::new() }; diff --git a/src/librustc_plugin/registry.rs b/src/librustc_plugin/registry.rs index 16d484e2a98..2fb65a60693 100644 --- a/src/librustc_plugin/registry.rs +++ b/src/librustc_plugin/registry.rs @@ -77,7 +77,7 @@ pub fn new(sess: &'a Session, krate_span: Span) -> Registry<'a> { /// /// Returns empty slice in case the plugin was loaded /// with `--extra-plugins` - pub fn args<'b>(&'b self) -> &'b [ast::NestedMetaItem] { + pub fn args(&self) -> &[ast::NestedMetaItem] { self.args_hidden.as_ref().map(|v| &v[..]).unwrap_or(&[]) } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 3e98200e532..339021f511a 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -337,7 +337,7 @@ fn item_tables<'a, 'tcx>( if tcx.has_typeck_tables(def_id) { tcx.typeck_tables_of(def_id) } else { empty_tables } } -fn min<'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx>) -> ty::Visibility { +fn min(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'_>) -> ty::Visibility { if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 } } @@ -384,14 +384,14 @@ fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display trait VisibilityLike: Sized { const MAX: Self; const SHALLOW: bool = false; - fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self; + fn new_min(find: &FindMin<'_, '_, Self>, def_id: DefId) -> Self; // Returns an over-approximation (`skip_assoc_tys` = true) of visibility due to // associated types for which we can't determine visibility precisely. - fn of_impl<'a, 'tcx>( + fn of_impl( hir_id: hir::HirId, - tcx: TyCtxt<'tcx>, - access_levels: &'a AccessLevels, + tcx: TyCtxt<'_>, + access_levels: &AccessLevels, ) -> Self { let mut find = FindMin { tcx, access_levels, min: Self::MAX }; let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); @@ -404,7 +404,7 @@ fn of_impl<'a, 'tcx>( } impl VisibilityLike for ty::Visibility { const MAX: Self = ty::Visibility::Public; - fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self { + fn new_min(find: &FindMin<'_, '_, Self>, def_id: DefId) -> Self { min(def_id_visibility(find.tcx, def_id).0, find.min, find.tcx) } } @@ -420,7 +420,7 @@ impl VisibilityLike for Option { // both "shallow" version of its self type and "shallow" version of its trait if it exists // (which require reaching the `DefId`s in them). const SHALLOW: bool = true; - fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self { + fn new_min(find: &FindMin<'_, '_, Self>, def_id: DefId) -> Self { cmp::min(if let Some(hir_id) = find.tcx.hir().as_local_hir_id(def_id) { find.access_levels.map.get(&hir_id).cloned() } else { @@ -1828,7 +1828,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn check_mod_privacy<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) { +fn check_mod_privacy(tcx: TyCtxt<'_>, module_def_id: DefId) { let empty_tables = ty::TypeckTables::empty(None); // Check privacy of names not checked in previous compilation stages. @@ -1855,7 +1855,7 @@ fn check_mod_privacy<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) { intravisit::walk_mod(&mut visitor, module, hir_id); } -fn privacy_access_levels<'tcx>(tcx: TyCtxt<'tcx>, krate: CrateNum) -> &'tcx AccessLevels { +fn privacy_access_levels(tcx: TyCtxt<'_>, krate: CrateNum) -> &AccessLevels { assert_eq!(krate, LOCAL_CRATE); // Build up a set of all exported items in the AST. This is a set of all @@ -1879,7 +1879,7 @@ fn privacy_access_levels<'tcx>(tcx: TyCtxt<'tcx>, krate: CrateNum) -> &'tcx Acce tcx.arena.alloc(visitor.access_levels) } -fn check_private_in_public<'tcx>(tcx: TyCtxt<'tcx>, krate: CrateNum) { +fn check_private_in_public(tcx: TyCtxt<'_>, krate: CrateNum) { assert_eq!(krate, LOCAL_CRATE); let access_levels = tcx.privacy_access_levels(LOCAL_CRATE); -- GitLab