mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
clippy::complexity fixes
This commit is contained in:
parent
291cadb2d8
commit
0b62b643e3
@ -25,7 +25,7 @@ fn clif_sig_from_fn_abi<'tcx>(
|
|||||||
) -> Signature {
|
) -> Signature {
|
||||||
let call_conv = conv_to_call_conv(tcx.sess, fn_abi.conv, default_call_conv);
|
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);
|
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.
|
// Sometimes the first param is an pointer to the place where the return value needs to be stored.
|
||||||
@ -513,10 +513,9 @@ pub(crate) fn codegen_terminator_call<'tcx>(
|
|||||||
args.into_iter()
|
args.into_iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.skip(if first_arg_override.is_some() { 1 } else { 0 })
|
.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()
|
adjust_arg_for_abi(fx, arg.value, &fn_abi.args[i], arg.is_owned).into_iter()
|
||||||
})
|
}),
|
||||||
.flatten(),
|
|
||||||
)
|
)
|
||||||
.collect::<Vec<Value>>();
|
.collect::<Vec<Value>>();
|
||||||
|
|
||||||
|
@ -1000,7 +1000,7 @@ fn codegen_panic_inner<'tcx>(
|
|||||||
let symbol_name = fx.tcx.symbol_name(instance).name;
|
let symbol_name = fx.tcx.symbol_name(instance).name;
|
||||||
|
|
||||||
fx.lib_call(
|
fx.lib_call(
|
||||||
&*symbol_name,
|
symbol_name,
|
||||||
args.iter().map(|&arg| AbiParam::new(fx.bcx.func.dfg.value_type(arg))).collect(),
|
args.iter().map(|&arg| AbiParam::new(fx.bcx.func.dfg.value_type(arg))).collect(),
|
||||||
vec![],
|
vec![],
|
||||||
args,
|
args,
|
||||||
|
@ -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() => {
|
ty::Adt(adt_def, _) if adt_def.repr().simd() => {
|
||||||
let (element, count) = match &tcx.layout_of(ParamEnv::reveal_all().and(ty)).unwrap().abi
|
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!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ fn data_id_for_static(
|
|||||||
};
|
};
|
||||||
|
|
||||||
let data_id = match module.declare_data(
|
let data_id = match module.declare_data(
|
||||||
&*symbol_name,
|
symbol_name,
|
||||||
linkage,
|
linkage,
|
||||||
is_mutable,
|
is_mutable,
|
||||||
attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL),
|
attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL),
|
||||||
@ -338,7 +338,7 @@ fn data_id_for_static(
|
|||||||
};
|
};
|
||||||
|
|
||||||
let data_id = match module.declare_data(
|
let data_id = match module.declare_data(
|
||||||
&*symbol_name,
|
symbol_name,
|
||||||
linkage,
|
linkage,
|
||||||
is_mutable,
|
is_mutable,
|
||||||
attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL),
|
attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL),
|
||||||
|
@ -113,7 +113,7 @@ impl Writer for WriterRelocate {
|
|||||||
offset: offset as u32,
|
offset: offset as u32,
|
||||||
size,
|
size,
|
||||||
name: DebugRelocName::Symbol(symbol),
|
name: DebugRelocName::Symbol(symbol),
|
||||||
addend: addend as i64,
|
addend,
|
||||||
kind: object::RelocationKind::Absolute,
|
kind: object::RelocationKind::Absolute,
|
||||||
});
|
});
|
||||||
self.write_udata(0, size)
|
self.write_udata(0, size)
|
||||||
|
@ -381,7 +381,7 @@ pub(crate) fn run_aot(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if tcx.dep_graph.is_fully_enabled() {
|
if tcx.dep_graph.is_fully_enabled() {
|
||||||
for cgu in &*cgus {
|
for cgu in cgus {
|
||||||
tcx.ensure().codegen_unit(cgu.name());
|
tcx.ensure().codegen_unit(cgu.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -421,7 +421,7 @@ pub(crate) fn run_aot(
|
|||||||
CguReuse::PreLto => unreachable!(),
|
CguReuse::PreLto => unreachable!(),
|
||||||
CguReuse::PostLto => {
|
CguReuse::PostLto => {
|
||||||
concurrency_limiter.job_already_done();
|
concurrency_limiter.job_already_done();
|
||||||
OngoingModuleCodegen::Sync(reuse_workproduct_for_cgu(tcx, &*cgu))
|
OngoingModuleCodegen::Sync(reuse_workproduct_for_cgu(tcx, cgu))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -242,7 +242,7 @@ pub(crate) fn codegen_inline_asm<'tcx>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
InlineAsmOperand::Const { ref value } => {
|
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"));
|
.unwrap_or_else(|| span_bug!(span, "asm const cannot be resolved"));
|
||||||
let value = rustc_codegen_ssa::common::asm_const_to_str(
|
let value = rustc_codegen_ssa::common::asm_const_to_str(
|
||||||
fx.tcx,
|
fx.tcx,
|
||||||
@ -334,13 +334,13 @@ pub(crate) fn codegen_inline_asm<'tcx>(
|
|||||||
}
|
}
|
||||||
CInlineAsmOperand::Out { reg: _, late: _, place } => {
|
CInlineAsmOperand::Out { reg: _, late: _, place } => {
|
||||||
if let Some(place) = 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 } => {
|
CInlineAsmOperand::InOut { reg: _, _late: _, in_value, out_place } => {
|
||||||
inputs.push((asm_gen.stack_slots_input[i].unwrap(), in_value.load_scalar(fx)));
|
inputs.push((asm_gen.stack_slots_input[i].unwrap(), in_value.load_scalar(fx)));
|
||||||
if let Some(out_place) = out_place {
|
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: _ } => {}
|
CInlineAsmOperand::Const { value: _ } | CInlineAsmOperand::Symbol { symbol: _ } => {}
|
||||||
|
@ -28,7 +28,7 @@ pub(crate) fn maybe_create_entry_wrapper(
|
|||||||
|
|
||||||
if main_def_id.is_local() {
|
if main_def_id.is_local() {
|
||||||
let instance = Instance::mono(tcx, main_def_id).polymorphize(tcx);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
} else if !is_primary_cgu {
|
} else if !is_primary_cgu {
|
||||||
|
@ -55,7 +55,7 @@ pub(crate) fn unsized_info<'tcx>(
|
|||||||
old_info
|
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),
|
_ => bug!("unsized_info: invalid unsizing {:?} -> {:?}", source, target),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user