clippy: main crate

This commit is contained in:
Ralf Jung 2022-06-04 11:55:36 -04:00
parent bd7f83dc37
commit 151b6b13e0
5 changed files with 11 additions and 13 deletions

View File

@ -9,7 +9,7 @@ fn fib(n: usize) -> usize {
for _ in 0..n {
let c = a;
a = b;
b = c + b;
b += c;
}
a
}

View File

@ -7,19 +7,16 @@
#![feature(io_error_more)]
#![warn(rust_2018_idioms)]
#![allow(
clippy::cast_lossless,
clippy::collapsible_else_if,
clippy::collapsible_if,
clippy::comparison_chain,
clippy::enum_variant_names,
clippy::field_reassign_with_default,
clippy::from_over_into,
clippy::if_same_then_else,
clippy::manual_map,
clippy::needless_lifetimes,
clippy::new_without_default,
clippy::single_match,
clippy::useless_format
clippy::useless_format,
clippy::derive_partial_eq_without_eq
)]
extern crate rustc_apfloat;

View File

@ -89,10 +89,10 @@ pub enum MiriMemoryKind {
Tls,
}
impl Into<MemoryKind<MiriMemoryKind>> for MiriMemoryKind {
impl From<MiriMemoryKind> for MemoryKind<MiriMemoryKind> {
#[inline(always)]
fn into(self) -> MemoryKind<MiriMemoryKind> {
MemoryKind::Machine(self)
fn from(kind: MiriMemoryKind) -> MemoryKind<MiriMemoryKind> {
MemoryKind::Machine(kind)
}
}

View File

@ -1389,7 +1389,7 @@ fn bool_to_simd_element(b: bool, size: Size) -> Scalar<Tag> {
Scalar::from_int(val, size)
}
fn simd_element_to_bool<'tcx>(elem: ImmTy<'tcx, Tag>) -> InterpResult<'tcx, bool> {
fn simd_element_to_bool(elem: ImmTy<'_, Tag>) -> InterpResult<'_, bool> {
let val = elem.to_scalar()?.to_int(elem.layout.size)?;
Ok(match val {
0 => false,

View File

@ -535,9 +535,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
throw_ub_format!(
"unlocked a PTHREAD_MUTEX_NORMAL mutex that was not locked by the current thread"
);
} else if kind == this.eval_libc("PTHREAD_MUTEX_ERRORCHECK")? {
this.eval_libc_i32("EPERM")
} else if kind == this.eval_libc("PTHREAD_MUTEX_RECURSIVE")? {
} else if kind == this.eval_libc("PTHREAD_MUTEX_ERRORCHECK")?
|| kind == this.eval_libc("PTHREAD_MUTEX_RECURSIVE")?
{
this.eval_libc_i32("EPERM")
} else {
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
let id = rwlock_get_or_create_id(this, rwlock_op)?;
let active_thread = this.get_active_thread();
#[allow(clippy::if_same_then_else)]
if this.rwlock_reader_unlock(id, active_thread) {
Ok(0)
} else if this.rwlock_writer_unlock(id, active_thread) {