diff options
| author | Ralf Jung <post@ralfj.de> | 2022-07-23 08:24:33 -0400 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-07-23 09:13:38 -0400 |
| commit | 3f0fdf290fe523fdbb6be21eafe4915638373fe8 (patch) | |
| tree | d58a06b227a6e2d03ac288c889138eade3cd68b4 /src | |
| parent | b9aad98a3b61e77e31317c6fef86ffff6bac175a (diff) | |
| download | rust-3f0fdf290fe523fdbb6be21eafe4915638373fe8.tar.gz rust-3f0fdf290fe523fdbb6be21eafe4915638373fe8.zip | |
pass clippy::cast_lossless
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 3 | ||||
| -rw-r--r-- | src/shims/env.rs | 2 | ||||
| -rw-r--r-- | src/shims/tls.rs | 2 | ||||
| -rw-r--r-- | src/stacked_borrows/item.rs | 2 |
4 files changed, 5 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs index 35351664caf..1a07ce9aa12 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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; diff --git a/src/shims/env.rs b/src/shims/env.rs index f0818e71b66..c1d39dc0928 100644 --- a/src/shims/env.rs +++ b/src/shims/env.rs @@ -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( diff --git a/src/shims/tls.rs b/src/shims/tls.rs index 13af447f76c..9d19160b84d 100644 --- a/src/shims/tls.rs +++ b/src/shims/tls.rs @@ -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) diff --git a/src/stacked_borrows/item.rs b/src/stacked_borrows/item.rs index ad1b9b075b4..709b27d191b 100644 --- a/src/stacked_borrows/item.rs +++ b/src/stacked_borrows/item.rs @@ -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); |
