From 0b2525c787454fa9afabd7bb8d60782af03fee5f Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 21 Aug 2024 01:29:52 -0400 Subject: [PATCH] Simplify some redundant field names --- compiler/rustc_ast_lowering/src/item.rs | 2 +- compiler/rustc_ast_passes/src/ast_validation.rs | 6 ++---- compiler/rustc_codegen_ssa/src/back/linker.rs | 4 ++-- compiler/rustc_hir_analysis/src/check/entry.rs | 2 +- compiler/rustc_hir_typeck/src/method/suggest.rs | 2 +- compiler/rustc_incremental/src/persist/fs.rs | 2 +- compiler/rustc_metadata/src/locator.rs | 8 ++------ compiler/rustc_mir_build/src/thir/cx/expr.rs | 7 +------ compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs | 2 +- compiler/rustc_mir_transform/src/coroutine.rs | 2 +- compiler/rustc_mir_transform/src/dataflow_const_prop.rs | 2 +- compiler/rustc_query_impl/src/lib.rs | 2 +- compiler/rustc_resolve/src/diagnostics.rs | 2 +- .../src/cfi/typeid/itanium_cxx_abi/transform.rs | 2 +- compiler/rustc_smir/src/rustc_smir/alloc.rs | 2 +- compiler/rustc_trait_selection/src/traits/auto_trait.rs | 2 +- 16 files changed, 19 insertions(+), 30 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index f6065259d8d..eef87879c24 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -1421,7 +1421,7 @@ pub(super) fn lower_fn_header( }; hir::FnHeader { safety: self.lower_safety(h.safety, default_safety), - asyncness: asyncness, + asyncness, constness: self.lower_constness(h.constness), abi: self.lower_extern(h.ext), } diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 837cb805700..f0f3049f0db 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -562,10 +562,8 @@ fn check_foreign_fn_headerless( FnHeader { safety: _, coroutine_kind, constness, ext }: FnHeader, ) { let report_err = |span| { - self.dcx().emit_err(errors::FnQualifierInExtern { - span: span, - block: self.current_extern_span(), - }); + self.dcx() + .emit_err(errors::FnQualifierInExtern { span, block: self.current_extern_span() }); }; match coroutine_kind { Some(knd) => report_err(knd.span()), diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index febeb7093a3..fbab988a32b 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -1500,7 +1500,7 @@ fn no_crt_objects(&mut self) {} impl<'a> L4Bender<'a> { pub fn new(cmd: Command, sess: &'a Session) -> L4Bender<'a> { - L4Bender { cmd, sess: sess, hinted_static: false } + L4Bender { cmd, sess, hinted_static: false } } fn hint_static(&mut self) { @@ -1520,7 +1520,7 @@ pub struct AixLinker<'a> { impl<'a> AixLinker<'a> { pub fn new(cmd: Command, sess: &'a Session) -> AixLinker<'a> { - AixLinker { cmd, sess: sess, hinted_static: None } + AixLinker { cmd, sess, hinted_static: None } } fn hint_static(&mut self) { diff --git a/compiler/rustc_hir_analysis/src/check/entry.rs b/compiler/rustc_hir_analysis/src/check/entry.rs index 1f724580564..83d2c2c1e28 100644 --- a/compiler/rustc_hir_analysis/src/check/entry.rs +++ b/compiler/rustc_hir_analysis/src/check/entry.rs @@ -216,7 +216,7 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) { } if sig.header.asyncness.is_async() { let span = tcx.def_span(it.owner_id); - tcx.dcx().emit_err(errors::StartAsync { span: span }); + tcx.dcx().emit_err(errors::StartAsync { span }); error = true; } diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index b3cf73bac1a..3df32dd8505 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -527,7 +527,7 @@ fn visit_stmt(&mut self, ex: &'v hir::Stmt<'v>) -> Self::Result { { if self.check_and_add_sugg_binding(LetStmt { ty_hir_id_opt: if let Some(ty) = ty { Some(ty.hir_id) } else { None }, - binding_id: binding_id, + binding_id, span: pat.span, init_hir_id: init.hir_id, }) { diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index 5f85e622e89..3388af1ada8 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -851,7 +851,7 @@ fn delete_old(sess: &Session, path: &Path) { debug!("garbage_collect_session_directories() - deleting `{}`", path.display()); if let Err(err) = safe_remove_dir_all(path) { - sess.dcx().emit_warn(errors::SessionGcFailed { path: path, err }); + sess.dcx().emit_warn(errors::SessionGcFailed { path, err }); } else { delete_session_dir_lock_file(sess, &lock_file_path(path)); } diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs index 25ae7b2bc31..90228db378a 100644 --- a/compiler/rustc_metadata/src/locator.rs +++ b/compiler/rustc_metadata/src/locator.rs @@ -1002,11 +1002,7 @@ pub(crate) fn report(self, sess: &Session, span: Span, missing_core: bool) { if !locator.crate_rejections.via_filename.is_empty() { let mismatches = locator.crate_rejections.via_filename.iter(); for CrateMismatch { path, .. } in mismatches { - dcx.emit_err(errors::CrateLocationUnknownType { - span, - path: path, - crate_name, - }); + dcx.emit_err(errors::CrateLocationUnknownType { span, path, crate_name }); dcx.emit_err(errors::LibFilenameForm { span, dll_prefix: &locator.dll_prefix, @@ -1035,7 +1031,7 @@ pub(crate) fn report(self, sess: &Session, span: Span, missing_core: bool) { } dcx.emit_err(errors::NewerCrateVersion { span, - crate_name: crate_name, + crate_name, add_info, found_crates, }); diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs index 2cbaed2cc62..89f98a40201 100644 --- a/compiler/rustc_mir_build/src/thir/cx/expr.rs +++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs @@ -218,12 +218,7 @@ fn mirror_expr_cast( let lhs = self.thir.exprs.push(Expr { temp_lifetime, ty: discr_ty, span, kind }); let bin = ExprKind::Binary { op: BinOp::Add, lhs, rhs: offset }; - self.thir.exprs.push(Expr { - temp_lifetime, - ty: discr_ty, - span: span, - kind: bin, - }) + self.thir.exprs.push(Expr { temp_lifetime, ty: discr_ty, span, kind: bin }) } None => offset, }; diff --git a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs index 6f8d17b772a..53393046610 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs @@ -129,7 +129,7 @@ fn to_pat(&mut self, c: ty::Const<'tcx>, ty: Ty<'tcx>) -> Box> { let err = TypeNotPartialEq { span: self.span, non_peq_ty: ty }; let e = self.tcx().dcx().emit_err(err); let kind = PatKind::Error(e); - return Box::new(Pat { span: self.span, ty: ty, kind }); + return Box::new(Pat { span: self.span, ty, kind }); } } diff --git a/compiler/rustc_mir_transform/src/coroutine.rs b/compiler/rustc_mir_transform/src/coroutine.rs index 82528109be9..703339bf5bc 100644 --- a/compiler/rustc_mir_transform/src/coroutine.rs +++ b/compiler/rustc_mir_transform/src/coroutine.rs @@ -931,7 +931,7 @@ fn compute_storage_conflicts<'mir, 'tcx>( // Compute the storage conflicts for all eligible locals. let mut visitor = StorageConflictVisitor { body, - saved_locals: saved_locals, + saved_locals, local_conflicts: BitMatrix::from_row_n(&ineligible_locals, body.local_decls.len()), eligible_storage_live: BitSet::new_empty(body.local_decls.len()), }; diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs index 0fc4d6b9f4e..f207216d6f4 100644 --- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs +++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs @@ -338,7 +338,7 @@ pub fn new(tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, map: Map<'tcx>) -> Self { tcx, local_decls: &body.local_decls, ecx: InterpCx::new(tcx, DUMMY_SP, param_env, DummyMachine), - param_env: param_env, + param_env, } } diff --git a/compiler/rustc_query_impl/src/lib.rs b/compiler/rustc_query_impl/src/lib.rs index 18f97d6fb8f..f4a4c602f69 100644 --- a/compiler/rustc_query_impl/src/lib.rs +++ b/compiler/rustc_query_impl/src/lib.rs @@ -214,7 +214,7 @@ pub fn query_system<'tcx>( local_providers, extern_providers, encode_query_results: encode_all_query_results, - try_mark_green: try_mark_green, + try_mark_green, }, jobs: AtomicU64::new(1), } diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 942026ef012..bcbdf627b56 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1456,7 +1456,7 @@ pub(crate) fn unresolved_macro_suggestions( let label_span = ident.span.shrink_to_hi(); let mut spans = MultiSpan::from_span(label_span); spans.push_span_label(label_span, "put a macro name here"); - err.subdiagnostic(MaybeMissingMacroRulesName { spans: spans }); + err.subdiagnostic(MaybeMissingMacroRulesName { spans }); return; } diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs index e628c17aca3..187dd870825 100644 --- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs +++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs @@ -316,7 +316,7 @@ pub fn transform_instance<'tcx>( .drop_trait() .unwrap_or_else(|| bug!("typeid_for_instance: couldn't get drop_trait lang item")); let predicate = ty::ExistentialPredicate::Trait(ty::ExistentialTraitRef { - def_id: def_id, + def_id, args: List::empty(), }); let predicates = tcx.mk_poly_existential_predicates(&[ty::Binder::dummy(predicate)]); diff --git a/compiler/rustc_smir/src/rustc_smir/alloc.rs b/compiler/rustc_smir/src/rustc_smir/alloc.rs index 0519722e4be..677b4c7a9c0 100644 --- a/compiler/rustc_smir/src/rustc_smir/alloc.rs +++ b/compiler/rustc_smir/src/rustc_smir/alloc.rs @@ -132,7 +132,7 @@ pub(super) fn allocation_filter<'tcx>( )); } Allocation { - bytes: bytes, + bytes, provenance: ProvenanceMap { ptrs }, align: alloc.align.bytes(), mutability: alloc.mutability.stable(tables), diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index 29f78f9d5f0..38d338598a1 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -770,7 +770,7 @@ fn evaluate_nested_obligations( let reported = tcx.dcx().emit_err(UnableToConstructConstantValue { span: tcx.def_span(unevaluated.def), - unevaluated: unevaluated, + unevaluated, }); Err(ErrorHandled::Reported(reported.into(), tcx.def_span(unevaluated.def))) }