clippy::complexity fixes

This commit is contained in:
Matthias Krüger 2023-02-10 18:47:08 +01:00
parent 291cadb2d8
commit 0b62b643e3
9 changed files with 15 additions and 16 deletions

View File

@ -25,7 +25,7 @@ fn clif_sig_from_fn_abi<'tcx>(
) -> Signature {
let call_conv = conv_to_call_conv(tcx.sess, fn_abi.conv, default_call_conv);
let inputs = fn_abi.args.iter().map(|arg_abi| arg_abi.get_abi_param(tcx).into_iter()).flatten();
let inputs = fn_abi.args.iter().flat_map(|arg_abi| arg_abi.get_abi_param(tcx).into_iter());
let (return_ptr, returns) = fn_abi.ret.get_abi_return(tcx);
// Sometimes the first param is an pointer to the place where the return value needs to be stored.
@ -513,10 +513,9 @@ enum CallTarget {
args.into_iter()
.enumerate()
.skip(if first_arg_override.is_some() { 1 } else { 0 })
.map(|(i, arg)| {
.flat_map(|(i, arg)| {
adjust_arg_for_abi(fx, arg.value, &fn_abi.args[i], arg.is_owned).into_iter()
})
.flatten(),
}),
)
.collect::<Vec<Value>>();

View File

@ -1000,7 +1000,7 @@ fn codegen_panic_inner<'tcx>(
let symbol_name = fx.tcx.symbol_name(instance).name;
fx.lib_call(
&*symbol_name,
symbol_name,
args.iter().map(|&arg| AbiParam::new(fx.bcx.func.dfg.value_type(arg))).collect(),
vec![],
args,

View File

@ -75,7 +75,7 @@ fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<types::Typ
ty::Adt(adt_def, _) if adt_def.repr().simd() => {
let (element, count) = match &tcx.layout_of(ParamEnv::reveal_all().and(ty)).unwrap().abi
{
Abi::Vector { element, count } => (element.clone(), *count),
Abi::Vector { element, count } => (*element, *count),
_ => unreachable!(),
};

View File

@ -290,7 +290,7 @@ fn data_id_for_static(
};
let data_id = match module.declare_data(
&*symbol_name,
symbol_name,
linkage,
is_mutable,
attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL),
@ -338,7 +338,7 @@ fn data_id_for_static(
};
let data_id = match module.declare_data(
&*symbol_name,
symbol_name,
linkage,
is_mutable,
attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL),

View File

@ -113,7 +113,7 @@ fn write_address(&mut self, address: Address, size: u8) -> Result<()> {
offset: offset as u32,
size,
name: DebugRelocName::Symbol(symbol),
addend: addend as i64,
addend,
kind: object::RelocationKind::Absolute,
});
self.write_udata(0, size)

View File

@ -381,7 +381,7 @@ pub(crate) fn run_aot(
};
if tcx.dep_graph.is_fully_enabled() {
for cgu in &*cgus {
for cgu in cgus {
tcx.ensure().codegen_unit(cgu.name());
}
}
@ -421,7 +421,7 @@ pub(crate) fn run_aot(
CguReuse::PreLto => unreachable!(),
CguReuse::PostLto => {
concurrency_limiter.job_already_done();
OngoingModuleCodegen::Sync(reuse_workproduct_for_cgu(tcx, &*cgu))
OngoingModuleCodegen::Sync(reuse_workproduct_for_cgu(tcx, cgu))
}
}
})

View File

@ -242,7 +242,7 @@ pub(crate) fn codegen_inline_asm<'tcx>(
}
}
InlineAsmOperand::Const { ref value } => {
let (const_value, ty) = crate::constant::eval_mir_constant(fx, &*value)
let (const_value, ty) = crate::constant::eval_mir_constant(fx, value)
.unwrap_or_else(|| span_bug!(span, "asm const cannot be resolved"));
let value = rustc_codegen_ssa::common::asm_const_to_str(
fx.tcx,
@ -334,13 +334,13 @@ pub(crate) fn codegen_inline_asm<'tcx>(
}
CInlineAsmOperand::Out { reg: _, late: _, place } => {
if let Some(place) = place {
outputs.push((asm_gen.stack_slots_output[i].unwrap(), place.clone()));
outputs.push((asm_gen.stack_slots_output[i].unwrap(), *place));
}
}
CInlineAsmOperand::InOut { reg: _, _late: _, in_value, out_place } => {
inputs.push((asm_gen.stack_slots_input[i].unwrap(), in_value.load_scalar(fx)));
if let Some(out_place) = out_place {
outputs.push((asm_gen.stack_slots_output[i].unwrap(), out_place.clone()));
outputs.push((asm_gen.stack_slots_output[i].unwrap(), *out_place));
}
}
CInlineAsmOperand::Const { value: _ } | CInlineAsmOperand::Symbol { symbol: _ } => {}

View File

@ -28,7 +28,7 @@ pub(crate) fn maybe_create_entry_wrapper(
if main_def_id.is_local() {
let instance = Instance::mono(tcx, main_def_id).polymorphize(tcx);
if !is_jit && module.get_name(&*tcx.symbol_name(instance).name).is_none() {
if !is_jit && module.get_name(tcx.symbol_name(instance).name).is_none() {
return;
}
} else if !is_primary_cgu {

View File

@ -55,7 +55,7 @@ pub(crate) fn unsized_info<'tcx>(
old_info
}
}
(_, &ty::Dynamic(ref data, ..)) => crate::vtable::get_vtable(fx, source, data.principal()),
(_, ty::Dynamic(data, ..)) => crate::vtable::get_vtable(fx, source, data.principal()),
_ => bug!("unsized_info: invalid unsizing {:?} -> {:?}", source, target),
}
}