Skip to content

Commit 151b6b1

Browse files
committed
clippy: main crate
1 parent bd7f83d commit 151b6b1

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

benches/helpers/fibonacci_helper_iterative.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn fib(n: usize) -> usize {
99
for _ in 0..n {
1010
let c = a;
1111
a = b;
12-
b = c + b;
12+
b += c;
1313
}
1414
a
1515
}

src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,16 @@
77
#![feature(io_error_more)]
88
#![warn(rust_2018_idioms)]
99
#![allow(
10-
clippy::cast_lossless,
1110
clippy::collapsible_else_if,
1211
clippy::collapsible_if,
1312
clippy::comparison_chain,
1413
clippy::enum_variant_names,
1514
clippy::field_reassign_with_default,
16-
clippy::from_over_into,
17-
clippy::if_same_then_else,
1815
clippy::manual_map,
19-
clippy::needless_lifetimes,
2016
clippy::new_without_default,
2117
clippy::single_match,
22-
clippy::useless_format
18+
clippy::useless_format,
19+
clippy::derive_partial_eq_without_eq
2320
)]
2421

2522
extern crate rustc_apfloat;

src/machine.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ pub enum MiriMemoryKind {
8989
Tls,
9090
}
9191

92-
impl Into<MemoryKind<MiriMemoryKind>> for MiriMemoryKind {
92+
impl From<MiriMemoryKind> for MemoryKind<MiriMemoryKind> {
9393
#[inline(always)]
94-
fn into(self) -> MemoryKind<MiriMemoryKind> {
95-
MemoryKind::Machine(self)
94+
fn from(kind: MiriMemoryKind) -> MemoryKind<MiriMemoryKind> {
95+
MemoryKind::Machine(kind)
9696
}
9797
}
9898

src/shims/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ fn bool_to_simd_element(b: bool, size: Size) -> Scalar<Tag> {
13891389
Scalar::from_int(val, size)
13901390
}
13911391

1392-
fn simd_element_to_bool<'tcx>(elem: ImmTy<'tcx, Tag>) -> InterpResult<'tcx, bool> {
1392+
fn simd_element_to_bool(elem: ImmTy<'_, Tag>) -> InterpResult<'_, bool> {
13931393
let val = elem.to_scalar()?.to_int(elem.layout.size)?;
13941394
Ok(match val {
13951395
0 => false,

src/shims/posix/sync.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
535535
throw_ub_format!(
536536
"unlocked a PTHREAD_MUTEX_NORMAL mutex that was not locked by the current thread"
537537
);
538-
} else if kind == this.eval_libc("PTHREAD_MUTEX_ERRORCHECK")? {
539-
this.eval_libc_i32("EPERM")
540-
} else if kind == this.eval_libc("PTHREAD_MUTEX_RECURSIVE")? {
538+
} else if kind == this.eval_libc("PTHREAD_MUTEX_ERRORCHECK")?
539+
|| kind == this.eval_libc("PTHREAD_MUTEX_RECURSIVE")?
540+
{
541541
this.eval_libc_i32("EPERM")
542542
} else {
543543
throw_unsup_format!("called pthread_mutex_unlock on an unsupported type of mutex");
@@ -642,6 +642,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
642642
let id = rwlock_get_or_create_id(this, rwlock_op)?;
643643
let active_thread = this.get_active_thread();
644644

645+
#[allow(clippy::if_same_then_else)]
645646
if this.rwlock_reader_unlock(id, active_thread) {
646647
Ok(0)
647648
} else if this.rwlock_writer_unlock(id, active_thread) {

0 commit comments

Comments
 (0)