pass clippy::cast_lossless

This commit is contained in:
Ralf Jung 2022-07-23 08:24:33 -04:00
parent b9aad98a3b
commit 3f0fdf290f
4 changed files with 5 additions and 4 deletions

View file

@ -9,7 +9,7 @@
#![feature(is_some_with)]
#![feature(nonzero_ops)]
#![feature(local_key_cell_methods)]
#![warn(rust_2018_idioms)]
// Configure clippy and other lints
#![allow(
clippy::collapsible_else_if,
clippy::collapsible_if,
@ -24,6 +24,7 @@
clippy::derive_hash_xor_eq,
clippy::too_many_arguments
)]
#![warn(rust_2018_idioms, clippy::cast_lossless)]
extern crate rustc_apfloat;
extern crate rustc_ast;

View file

@ -202,7 +202,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
let env_block_ptr = this.read_pointer(env_block_op)?;
let result = this.deallocate_ptr(env_block_ptr, None, MiriMemoryKind::Runtime.into());
// If the function succeeds, the return value is nonzero.
Ok(result.is_ok() as i32)
Ok(i32::from(result.is_ok()))
}
fn setenv(

View file

@ -73,7 +73,7 @@ impl<'tcx> TlsData<'tcx> {
self.keys.try_insert(new_key, TlsEntry { data: Default::default(), dtor }).unwrap();
trace!("New TLS key allocated: {} with dtor {:?}", new_key, dtor);
if max_size.bits() < 128 && new_key >= (1u128 << max_size.bits() as u128) {
if max_size.bits() < 128 && new_key >= (1u128 << max_size.bits()) {
throw_unsup_format!("we ran out of TLS key space");
}
Ok(new_key)

View file

@ -22,7 +22,7 @@ impl Item {
assert!(tag.0.get() <= TAG_MASK);
let packed_tag = tag.0.get();
let packed_perm = perm.to_bits() << PERM_SHIFT;
let packed_protected = (protected as u64) << PROTECTED_SHIFT;
let packed_protected = u64::from(protected) << PROTECTED_SHIFT;
let new = Self(packed_tag | packed_perm | packed_protected);