Skip to content

Commit efd33c5

Browse files
authored
Merge pull request rust-lang#1356 from matthiaskrgr/clippy_compl
clippy::complexity fixes
2 parents 291cadb + 0b62b64 commit efd33c5

File tree

9 files changed

+15
-16
lines changed

9 files changed

+15
-16
lines changed

src/abi/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn clif_sig_from_fn_abi<'tcx>(
2525
) -> Signature {
2626
let call_conv = conv_to_call_conv(tcx.sess, fn_abi.conv, default_call_conv);
2727

28-
let inputs = fn_abi.args.iter().map(|arg_abi| arg_abi.get_abi_param(tcx).into_iter()).flatten();
28+
let inputs = fn_abi.args.iter().flat_map(|arg_abi| arg_abi.get_abi_param(tcx).into_iter());
2929

3030
let (return_ptr, returns) = fn_abi.ret.get_abi_return(tcx);
3131
// 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>(
513513
args.into_iter()
514514
.enumerate()
515515
.skip(if first_arg_override.is_some() { 1 } else { 0 })
516-
.map(|(i, arg)| {
516+
.flat_map(|(i, arg)| {
517517
adjust_arg_for_abi(fx, arg.value, &fn_abi.args[i], arg.is_owned).into_iter()
518-
})
519-
.flatten(),
518+
}),
520519
)
521520
.collect::<Vec<Value>>();
522521

src/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ fn codegen_panic_inner<'tcx>(
10001000
let symbol_name = fx.tcx.symbol_name(instance).name;
10011001

10021002
fx.lib_call(
1003-
&*symbol_name,
1003+
symbol_name,
10041004
args.iter().map(|&arg| AbiParam::new(fx.bcx.func.dfg.value_type(arg))).collect(),
10051005
vec![],
10061006
args,

src/common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<types::Typ
7575
ty::Adt(adt_def, _) if adt_def.repr().simd() => {
7676
let (element, count) = match &tcx.layout_of(ParamEnv::reveal_all().and(ty)).unwrap().abi
7777
{
78-
Abi::Vector { element, count } => (element.clone(), *count),
78+
Abi::Vector { element, count } => (*element, *count),
7979
_ => unreachable!(),
8080
};
8181

src/constant.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ fn data_id_for_static(
290290
};
291291

292292
let data_id = match module.declare_data(
293-
&*symbol_name,
293+
symbol_name,
294294
linkage,
295295
is_mutable,
296296
attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL),
@@ -338,7 +338,7 @@ fn data_id_for_static(
338338
};
339339

340340
let data_id = match module.declare_data(
341-
&*symbol_name,
341+
symbol_name,
342342
linkage,
343343
is_mutable,
344344
attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL),

src/debuginfo/emit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl Writer for WriterRelocate {
113113
offset: offset as u32,
114114
size,
115115
name: DebugRelocName::Symbol(symbol),
116-
addend: addend as i64,
116+
addend,
117117
kind: object::RelocationKind::Absolute,
118118
});
119119
self.write_udata(0, size)

src/driver/aot.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ pub(crate) fn run_aot(
381381
};
382382

383383
if tcx.dep_graph.is_fully_enabled() {
384-
for cgu in &*cgus {
384+
for cgu in cgus {
385385
tcx.ensure().codegen_unit(cgu.name());
386386
}
387387
}
@@ -421,7 +421,7 @@ pub(crate) fn run_aot(
421421
CguReuse::PreLto => unreachable!(),
422422
CguReuse::PostLto => {
423423
concurrency_limiter.job_already_done();
424-
OngoingModuleCodegen::Sync(reuse_workproduct_for_cgu(tcx, &*cgu))
424+
OngoingModuleCodegen::Sync(reuse_workproduct_for_cgu(tcx, cgu))
425425
}
426426
}
427427
})

src/inline_asm.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ pub(crate) fn codegen_inline_asm<'tcx>(
242242
}
243243
}
244244
InlineAsmOperand::Const { ref value } => {
245-
let (const_value, ty) = crate::constant::eval_mir_constant(fx, &*value)
245+
let (const_value, ty) = crate::constant::eval_mir_constant(fx, value)
246246
.unwrap_or_else(|| span_bug!(span, "asm const cannot be resolved"));
247247
let value = rustc_codegen_ssa::common::asm_const_to_str(
248248
fx.tcx,
@@ -334,13 +334,13 @@ pub(crate) fn codegen_inline_asm<'tcx>(
334334
}
335335
CInlineAsmOperand::Out { reg: _, late: _, place } => {
336336
if let Some(place) = place {
337-
outputs.push((asm_gen.stack_slots_output[i].unwrap(), place.clone()));
337+
outputs.push((asm_gen.stack_slots_output[i].unwrap(), *place));
338338
}
339339
}
340340
CInlineAsmOperand::InOut { reg: _, _late: _, in_value, out_place } => {
341341
inputs.push((asm_gen.stack_slots_input[i].unwrap(), in_value.load_scalar(fx)));
342342
if let Some(out_place) = out_place {
343-
outputs.push((asm_gen.stack_slots_output[i].unwrap(), out_place.clone()));
343+
outputs.push((asm_gen.stack_slots_output[i].unwrap(), *out_place));
344344
}
345345
}
346346
CInlineAsmOperand::Const { value: _ } | CInlineAsmOperand::Symbol { symbol: _ } => {}

src/main_shim.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(crate) fn maybe_create_entry_wrapper(
2828

2929
if main_def_id.is_local() {
3030
let instance = Instance::mono(tcx, main_def_id).polymorphize(tcx);
31-
if !is_jit && module.get_name(&*tcx.symbol_name(instance).name).is_none() {
31+
if !is_jit && module.get_name(tcx.symbol_name(instance).name).is_none() {
3232
return;
3333
}
3434
} else if !is_primary_cgu {

src/unsize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub(crate) fn unsized_info<'tcx>(
5555
old_info
5656
}
5757
}
58-
(_, &ty::Dynamic(ref data, ..)) => crate::vtable::get_vtable(fx, source, data.principal()),
58+
(_, ty::Dynamic(data, ..)) => crate::vtable::get_vtable(fx, source, data.principal()),
5959
_ => bug!("unsized_info: invalid unsizing {:?} -> {:?}", source, target),
6060
}
6161
}

0 commit comments

Comments
 (0)