From 5dd7550a0887eb3a4edcad3f29de909b02e2e735 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 22 Jun 2023 09:18:09 +1000 Subject: [PATCH] Avoid `Lrc>`. Because `Lrc>` is silly. (Clippy warns about `Rc>` and `Arc>`, and it would warn here if (a) we used Clippy with rustc, and (b) Clippy knew about `Lrc`.) --- compiler/rustc_driver_impl/src/lib.rs | 4 ++-- compiler/rustc_interface/src/interface.rs | 6 +++--- compiler/rustc_interface/src/queries.rs | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 0db96d4e735f6..a08d53e28c637 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -329,7 +329,7 @@ fn run_compiler( return; } let should_stop = - print_crate_info(&***compiler.codegen_backend(), compiler.session(), false); + print_crate_info(&**compiler.codegen_backend(), compiler.session(), false); if should_stop == Compilation::Stop { return; @@ -351,7 +351,7 @@ fn run_compiler( interface::run_compiler(config, |compiler| { let sess = compiler.session(); - let should_stop = print_crate_info(&***compiler.codegen_backend(), sess, true) + let should_stop = print_crate_info(&**compiler.codegen_backend(), sess, true) .and_then(|| list_metadata(sess, &*compiler.codegen_backend().metadata_loader())) .and_then(|| try_process_rlink(sess, compiler)); diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 5e3ea71f0e768..54dabb757643a 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -36,7 +36,7 @@ pub type Result = result::Result; /// Created by passing [`Config`] to [`run_compiler`]. pub struct Compiler { pub(crate) sess: Lrc, - codegen_backend: Lrc>, + codegen_backend: Lrc, pub(crate) register_lints: Option>, pub(crate) override_queries: Option, } @@ -45,7 +45,7 @@ impl Compiler { pub fn session(&self) -> &Lrc { &self.sess } - pub fn codegen_backend(&self) -> &Lrc> { + pub fn codegen_backend(&self) -> &Lrc { &self.codegen_backend } pub fn register_lints(&self) -> &Option> { @@ -318,7 +318,7 @@ pub fn run_compiler(config: Config, f: impl FnOnce(&Compiler) -> R + Se let compiler = Compiler { sess: Lrc::new(sess), - codegen_backend: Lrc::new(codegen_backend), + codegen_backend: Lrc::from(codegen_backend), register_lints: config.register_lints, override_queries: config.override_queries, }; diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index d1ba748d7af4b..8c4cdc6696a46 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -115,7 +115,7 @@ impl<'tcx> Queries<'tcx> { fn session(&self) -> &Lrc { &self.compiler.sess } - fn codegen_backend(&self) -> &Lrc> { + fn codegen_backend(&self) -> &Lrc { self.compiler.codegen_backend() } @@ -259,7 +259,7 @@ impl<'tcx> Queries<'tcx> { // Hook for UI tests. Self::check_for_rustc_errors_attr(tcx); - Ok(passes::start_codegen(&***self.codegen_backend(), tcx)) + Ok(passes::start_codegen(&**self.codegen_backend(), tcx)) }) } @@ -324,7 +324,7 @@ impl<'tcx> Queries<'tcx> { pub struct Linker { // compilation inputs sess: Lrc, - codegen_backend: Lrc>, + codegen_backend: Lrc, // compilation outputs dep_graph: DepGraph,