Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 826189e

Browse files
committed
Some clippy fixes
1 parent 8f62149 commit 826189e

File tree

7 files changed

+13
-15
lines changed

7 files changed

+13
-15
lines changed

src/abi/pass_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub(super) fn from_casted_value<'tcx>(
208208
});
209209
let ptr = Pointer::new(fx.bcx.ins().stack_addr(pointer_ty(fx.tcx), stack_slot, 0));
210210
let mut offset = 0;
211-
let mut block_params_iter = block_params.into_iter().copied();
211+
let mut block_params_iter = block_params.iter().copied();
212212
for param in abi_params {
213213
let val = ptr.offset_i64(fx, offset).store(
214214
fx,

src/abi/returning.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub(super) fn codegen_with_call_return_arg<'tcx, T>(
142142
let results = fx
143143
.bcx
144144
.inst_results(call_inst)
145-
.into_iter()
145+
.iter()
146146
.copied()
147147
.collect::<SmallVec<[Value; 2]>>();
148148
let result =

src/debuginfo/line_info.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ fn osstr_as_utf8_bytes(path: &OsStr) -> &[u8] {
3939
#[cfg(unix)]
4040
{
4141
use std::os::unix::ffi::OsStrExt;
42-
return path.as_bytes();
42+
path.as_bytes()
4343
}
4444
#[cfg(not(unix))]
4545
{
46-
return path.to_str().unwrap().as_bytes();
46+
path.to_str().unwrap().as_bytes()
4747
}
4848
}
4949

src/intrinsics/simd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
8888
let idx_bytes = match idx_const.val {
8989
ty::ConstKind::Value(ConstValue::ByRef { alloc, offset }) => {
9090
let ptr = Pointer::new(AllocId(0 /* dummy */), offset);
91-
let size = Size::from_bytes(4 * u64::from(ret_lane_count) /* size_of([u32; ret_lane_count]) */);
91+
let size = Size::from_bytes(4 * ret_lane_count /* size_of([u32; ret_lane_count]) */);
9292
alloc.get_bytes(fx, ptr, size).unwrap()
9393
}
9494
_ => unreachable!("{:?}", idx_const),

src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ impl CodegenBackend for CraneliftCodegenBackend {
240240
vec![]
241241
}
242242

243-
fn codegen_crate<'tcx>(
243+
fn codegen_crate(
244244
&self,
245-
tcx: TyCtxt<'tcx>,
245+
tcx: TyCtxt<'_>,
246246
metadata: EncodedMetadata,
247247
need_metadata_module: bool,
248248
) -> Box<dyn Any> {
@@ -252,9 +252,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
252252
BackendConfig::from_opts(&tcx.sess.opts.cg.llvm_args)
253253
.unwrap_or_else(|err| tcx.sess.fatal(&err))
254254
};
255-
let res = driver::codegen_crate(tcx, metadata, need_metadata_module, config);
256-
257-
res
255+
driver::codegen_crate(tcx, metadata, need_metadata_module, config)
258256
}
259257

260258
fn join_codegen(

src/num.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ pub(crate) fn codegen_ptr_binop<'tcx>(
387387
let lhs = in_lhs.load_scalar(fx);
388388
let rhs = in_rhs.load_scalar(fx);
389389

390-
return codegen_compare_bin_op(fx, bin_op, false, lhs, rhs);
390+
codegen_compare_bin_op(fx, bin_op, false, lhs, rhs)
391391
}
392392
BinOp::Offset => {
393393
let pointee_ty = in_lhs.layout().ty.builtin_deref(true).unwrap().ty;
@@ -396,10 +396,10 @@ pub(crate) fn codegen_ptr_binop<'tcx>(
396396
let ptr_diff = fx.bcx.ins().imul_imm(offset, pointee_size as i64);
397397
let base_val = base.load_scalar(fx);
398398
let res = fx.bcx.ins().iadd(base_val, ptr_diff);
399-
return CValue::by_val(res, base.layout());
399+
CValue::by_val(res, base.layout())
400400
}
401401
_ => unreachable!("{:?}({:?}, {:?})", bin_op, in_lhs, in_rhs),
402-
};
402+
}
403403
} else {
404404
let (lhs_ptr, lhs_extra) = in_lhs.load_scalar_pair(fx);
405405
let (rhs_ptr, rhs_extra) = in_rhs.load_scalar_pair(fx);

src/pretty_clif.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ pub(crate) fn should_write_ir(tcx: TyCtxt<'_>) -> bool {
205205
tcx.sess.opts.output_types.contains_key(&OutputType::LlvmAssembly)
206206
}
207207

208-
pub(crate) fn write_ir_file<'tcx>(
209-
tcx: TyCtxt<'tcx>,
208+
pub(crate) fn write_ir_file(
209+
tcx: TyCtxt<'_>,
210210
name: &str,
211211
write: impl FnOnce(&mut dyn Write) -> std::io::Result<()>,
212212
) {

0 commit comments

Comments
 (0)