Rollup merge of #129345 - compiler-errors:scratch4, r=jieyouxu
Use shorthand field initialization syntax more aggressively in the compiler Caught these when cleaning up #129344 and decided to run clippy to find the rest
This commit is contained in:
commit
4137f3bc15
@ -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),
|
||||
}
|
||||
|
@ -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()),
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
}) {
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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,
|
||||
});
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -129,7 +129,7 @@ fn to_pat(&mut self, c: ty::Const<'tcx>, ty: Ty<'tcx>) -> Box<Pat<'tcx>> {
|
||||
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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()),
|
||||
};
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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),
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)]);
|
||||
|
@ -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),
|
||||
|
@ -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)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user