Simplify some redundant field names

This commit is contained in:
Michael Goulet 2024-08-21 01:29:52 -04:00
parent 636d7ff91b
commit 0b2525c787
16 changed files with 19 additions and 30 deletions

View File

@ -1421,7 +1421,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
}; };
hir::FnHeader { hir::FnHeader {
safety: self.lower_safety(h.safety, default_safety), safety: self.lower_safety(h.safety, default_safety),
asyncness: asyncness, asyncness,
constness: self.lower_constness(h.constness), constness: self.lower_constness(h.constness),
abi: self.lower_extern(h.ext), abi: self.lower_extern(h.ext),
} }

View File

@ -562,10 +562,8 @@ impl<'a> AstValidator<'a> {
FnHeader { safety: _, coroutine_kind, constness, ext }: FnHeader, FnHeader { safety: _, coroutine_kind, constness, ext }: FnHeader,
) { ) {
let report_err = |span| { let report_err = |span| {
self.dcx().emit_err(errors::FnQualifierInExtern { self.dcx()
span: span, .emit_err(errors::FnQualifierInExtern { span, block: self.current_extern_span() });
block: self.current_extern_span(),
});
}; };
match coroutine_kind { match coroutine_kind {
Some(knd) => report_err(knd.span()), Some(knd) => report_err(knd.span()),

View File

@ -1500,7 +1500,7 @@ impl<'a> Linker for L4Bender<'a> {
impl<'a> L4Bender<'a> { impl<'a> L4Bender<'a> {
pub fn new(cmd: Command, sess: &'a Session) -> 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) { fn hint_static(&mut self) {
@ -1520,7 +1520,7 @@ pub struct AixLinker<'a> {
impl<'a> AixLinker<'a> { impl<'a> AixLinker<'a> {
pub fn new(cmd: Command, sess: &'a Session) -> 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) { fn hint_static(&mut self) {

View File

@ -216,7 +216,7 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) {
} }
if sig.header.asyncness.is_async() { if sig.header.asyncness.is_async() {
let span = tcx.def_span(it.owner_id); 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; error = true;
} }

View File

@ -527,7 +527,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
{ {
if self.check_and_add_sugg_binding(LetStmt { if self.check_and_add_sugg_binding(LetStmt {
ty_hir_id_opt: if let Some(ty) = ty { Some(ty.hir_id) } else { None }, ty_hir_id_opt: if let Some(ty) = ty { Some(ty.hir_id) } else { None },
binding_id: binding_id, binding_id,
span: pat.span, span: pat.span,
init_hir_id: init.hir_id, init_hir_id: init.hir_id,
}) { }) {

View File

@ -851,7 +851,7 @@ fn delete_old(sess: &Session, path: &Path) {
debug!("garbage_collect_session_directories() - deleting `{}`", path.display()); debug!("garbage_collect_session_directories() - deleting `{}`", path.display());
if let Err(err) = safe_remove_dir_all(path) { 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 { } else {
delete_session_dir_lock_file(sess, &lock_file_path(path)); delete_session_dir_lock_file(sess, &lock_file_path(path));
} }

View File

@ -1002,11 +1002,7 @@ impl CrateError {
if !locator.crate_rejections.via_filename.is_empty() { if !locator.crate_rejections.via_filename.is_empty() {
let mismatches = locator.crate_rejections.via_filename.iter(); let mismatches = locator.crate_rejections.via_filename.iter();
for CrateMismatch { path, .. } in mismatches { for CrateMismatch { path, .. } in mismatches {
dcx.emit_err(errors::CrateLocationUnknownType { dcx.emit_err(errors::CrateLocationUnknownType { span, path, crate_name });
span,
path: path,
crate_name,
});
dcx.emit_err(errors::LibFilenameForm { dcx.emit_err(errors::LibFilenameForm {
span, span,
dll_prefix: &locator.dll_prefix, dll_prefix: &locator.dll_prefix,
@ -1035,7 +1031,7 @@ impl CrateError {
} }
dcx.emit_err(errors::NewerCrateVersion { dcx.emit_err(errors::NewerCrateVersion {
span, span,
crate_name: crate_name, crate_name,
add_info, add_info,
found_crates, found_crates,
}); });

View File

@ -218,12 +218,7 @@ impl<'tcx> Cx<'tcx> {
let lhs = let lhs =
self.thir.exprs.push(Expr { temp_lifetime, ty: discr_ty, span, kind }); self.thir.exprs.push(Expr { temp_lifetime, ty: discr_ty, span, kind });
let bin = ExprKind::Binary { op: BinOp::Add, lhs, rhs: offset }; let bin = ExprKind::Binary { op: BinOp::Add, lhs, rhs: offset };
self.thir.exprs.push(Expr { self.thir.exprs.push(Expr { temp_lifetime, ty: discr_ty, span, kind: bin })
temp_lifetime,
ty: discr_ty,
span: span,
kind: bin,
})
} }
None => offset, None => offset,
}; };

View File

@ -129,7 +129,7 @@ impl<'tcx> ConstToPat<'tcx> {
let err = TypeNotPartialEq { span: self.span, non_peq_ty: ty }; let err = TypeNotPartialEq { span: self.span, non_peq_ty: ty };
let e = self.tcx().dcx().emit_err(err); let e = self.tcx().dcx().emit_err(err);
let kind = PatKind::Error(e); let kind = PatKind::Error(e);
return Box::new(Pat { span: self.span, ty: ty, kind }); return Box::new(Pat { span: self.span, ty, kind });
} }
} }

View File

@ -931,7 +931,7 @@ fn compute_storage_conflicts<'mir, 'tcx>(
// Compute the storage conflicts for all eligible locals. // Compute the storage conflicts for all eligible locals.
let mut visitor = StorageConflictVisitor { let mut visitor = StorageConflictVisitor {
body, body,
saved_locals: saved_locals, saved_locals,
local_conflicts: BitMatrix::from_row_n(&ineligible_locals, body.local_decls.len()), local_conflicts: BitMatrix::from_row_n(&ineligible_locals, body.local_decls.len()),
eligible_storage_live: BitSet::new_empty(body.local_decls.len()), eligible_storage_live: BitSet::new_empty(body.local_decls.len()),
}; };

View File

@ -338,7 +338,7 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> {
tcx, tcx,
local_decls: &body.local_decls, local_decls: &body.local_decls,
ecx: InterpCx::new(tcx, DUMMY_SP, param_env, DummyMachine), ecx: InterpCx::new(tcx, DUMMY_SP, param_env, DummyMachine),
param_env: param_env, param_env,
} }
} }

View File

@ -214,7 +214,7 @@ pub fn query_system<'tcx>(
local_providers, local_providers,
extern_providers, extern_providers,
encode_query_results: encode_all_query_results, encode_query_results: encode_all_query_results,
try_mark_green: try_mark_green, try_mark_green,
}, },
jobs: AtomicU64::new(1), jobs: AtomicU64::new(1),
} }

View File

@ -1456,7 +1456,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let label_span = ident.span.shrink_to_hi(); let label_span = ident.span.shrink_to_hi();
let mut spans = MultiSpan::from_span(label_span); let mut spans = MultiSpan::from_span(label_span);
spans.push_span_label(label_span, "put a macro name here"); spans.push_span_label(label_span, "put a macro name here");
err.subdiagnostic(MaybeMissingMacroRulesName { spans: spans }); err.subdiagnostic(MaybeMissingMacroRulesName { spans });
return; return;
} }

View File

@ -316,7 +316,7 @@ pub fn transform_instance<'tcx>(
.drop_trait() .drop_trait()
.unwrap_or_else(|| bug!("typeid_for_instance: couldn't get drop_trait lang item")); .unwrap_or_else(|| bug!("typeid_for_instance: couldn't get drop_trait lang item"));
let predicate = ty::ExistentialPredicate::Trait(ty::ExistentialTraitRef { let predicate = ty::ExistentialPredicate::Trait(ty::ExistentialTraitRef {
def_id: def_id, def_id,
args: List::empty(), args: List::empty(),
}); });
let predicates = tcx.mk_poly_existential_predicates(&[ty::Binder::dummy(predicate)]); let predicates = tcx.mk_poly_existential_predicates(&[ty::Binder::dummy(predicate)]);

View File

@ -132,7 +132,7 @@ pub(super) fn allocation_filter<'tcx>(
)); ));
} }
Allocation { Allocation {
bytes: bytes, bytes,
provenance: ProvenanceMap { ptrs }, provenance: ProvenanceMap { ptrs },
align: alloc.align.bytes(), align: alloc.align.bytes(),
mutability: alloc.mutability.stable(tables), mutability: alloc.mutability.stable(tables),

View File

@ -770,7 +770,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
let reported = let reported =
tcx.dcx().emit_err(UnableToConstructConstantValue { tcx.dcx().emit_err(UnableToConstructConstantValue {
span: tcx.def_span(unevaluated.def), span: tcx.def_span(unevaluated.def),
unevaluated: unevaluated, unevaluated,
}); });
Err(ErrorHandled::Reported(reported.into(), tcx.def_span(unevaluated.def))) Err(ErrorHandled::Reported(reported.into(), tcx.def_span(unevaluated.def)))
} }