diff options
| author | bors <bors@rust-lang.org> | 2023-11-21 22:34:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-11-21 22:34:19 +0000 |
| commit | fec80b4475c871ad3e4d70d29d1781ee771fe631 (patch) | |
| tree | 9397b939e5b564fab21d6f252d3f737625e40df8 /compiler/rustc_interface/src | |
| parent | 2f8d81f9dbac6b8df982199f69da04a4c8357227 (diff) | |
| parent | 21a870515b18e5b2b90435d0f1a6d3089b5217ae (diff) | |
| download | rust-fec80b4475c871ad3e4d70d29d1781ee771fe631.tar.gz rust-fec80b4475c871ad3e4d70d29d1781ee771fe631.zip | |
Auto merge of #118143 - Nilstrieb:only-borrow-what-you-need, r=compiler-errors
Fix `clippy::needless_borrow` in the compiler `x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now. r? `@compiler-errors` you told me you want to review this I will do a self review first (which, for this, is easiest on GitHub once the PR is open) - did it
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 20 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/queries.rs | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 0baf77c4f7e..ec024dac8dd 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -127,7 +127,7 @@ fn configure_and_expand( let tcx = resolver.tcx(); let sess = tcx.sess; let features = tcx.features(); - let lint_store = unerased_lint_store(&tcx.sess); + let lint_store = unerased_lint_store(tcx.sess); let crate_name = tcx.crate_name(LOCAL_CRATE); let lint_check_node = (&krate, pre_configured_attrs); pre_expansion_lint( @@ -150,7 +150,7 @@ fn configure_and_expand( ) }); - util::check_attr_crate_type(sess, pre_configured_attrs, &mut resolver.lint_buffer()); + util::check_attr_crate_type(sess, pre_configured_attrs, resolver.lint_buffer()); // Expand all macros krate = sess.time("macro_expand_crate", || { @@ -284,16 +284,16 @@ fn early_lint_checks(tcx: TyCtxt<'_>, (): ()) { let mut lint_buffer = resolver.lint_buffer.steal(); if sess.opts.unstable_opts.input_stats { - eprintln!("Post-expansion node count: {}", count_nodes(&krate)); + eprintln!("Post-expansion node count: {}", count_nodes(krate)); } if sess.opts.unstable_opts.hir_stats { - hir_stats::print_ast_stats(&krate, "POST EXPANSION AST STATS", "ast-stats-2"); + hir_stats::print_ast_stats(krate, "POST EXPANSION AST STATS", "ast-stats-2"); } // Needs to go *after* expansion to be able to check the results of macro expansion. sess.time("complete_gated_feature_checking", || { - rustc_ast_passes::feature_gate::check_crate(&krate, sess, tcx.features()); + rustc_ast_passes::feature_gate::check_crate(krate, sess, tcx.features()); }); // Add all buffered lints from the `ParseSess` to the `Session`. @@ -319,7 +319,7 @@ fn early_lint_checks(tcx: TyCtxt<'_>, (): ()) { } }); - let lint_store = unerased_lint_store(&tcx.sess); + let lint_store = unerased_lint_store(tcx.sess); rustc_lint::check_ast_node( sess, tcx.features(), @@ -521,11 +521,11 @@ fn write_out_deps(tcx: TyCtxt<'_>, outputs: &OutputFilenames, out_filenames: &[P if sess.opts.json_artifact_notifications { sess.parse_sess .span_diagnostic - .emit_artifact_notification(&deps_filename, "dep-info"); + .emit_artifact_notification(deps_filename, "dep-info"); } } Err(error) => { - sess.emit_fatal(errors::ErrorWritingDependencies { path: &deps_filename, error }); + sess.emit_fatal(errors::ErrorWritingDependencies { path: deps_filename, error }); } } } @@ -564,12 +564,12 @@ fn output_filenames(tcx: TyCtxt<'_>, (): ()) -> Arc<OutputFilenames> { generated_output_paths(tcx, &outputs, sess.io.output_file.is_some(), crate_name); // Ensure the source file isn't accidentally overwritten during compilation. - if let Some(ref input_path) = sess.io.input.opt_path() { + if let Some(input_path) = sess.io.input.opt_path() { if sess.opts.will_create_output_file() { if output_contains_path(&output_paths, input_path) { sess.emit_fatal(errors::InputFileWouldBeOverWritten { path: input_path }); } - if let Some(ref dir_path) = output_conflicts_with_dir(&output_paths) { + if let Some(dir_path) = output_conflicts_with_dir(&output_paths) { sess.emit_fatal(errors::GeneratedFileConflictsWithDirectory { input_path, dir_path, diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index fbf2dbcdae5..3fee2d28981 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -102,7 +102,7 @@ impl<'tcx> Queries<'tcx> { } fn session(&self) -> &Session { - &self.compiler.session() + self.compiler.session() } fn codegen_backend(&self) -> &dyn CodegenBackend { |
