Skip to content

Commit 3f0fdf2

Browse files
committed
pass clippy::cast_lossless
1 parent b9aad98 commit 3f0fdf2

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#![feature(is_some_with)]
1010
#![feature(nonzero_ops)]
1111
#![feature(local_key_cell_methods)]
12-
#![warn(rust_2018_idioms)]
12+
// Configure clippy and other lints
1313
#![allow(
1414
clippy::collapsible_else_if,
1515
clippy::collapsible_if,
@@ -24,6 +24,7 @@
2424
clippy::derive_hash_xor_eq,
2525
clippy::too_many_arguments
2626
)]
27+
#![warn(rust_2018_idioms, clippy::cast_lossless)]
2728

2829
extern crate rustc_apfloat;
2930
extern crate rustc_ast;

src/shims/env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
202202
let env_block_ptr = this.read_pointer(env_block_op)?;
203203
let result = this.deallocate_ptr(env_block_ptr, None, MiriMemoryKind::Runtime.into());
204204
// If the function succeeds, the return value is nonzero.
205-
Ok(result.is_ok() as i32)
205+
Ok(i32::from(result.is_ok()))
206206
}
207207

208208
fn setenv(

src/shims/tls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<'tcx> TlsData<'tcx> {
7373
self.keys.try_insert(new_key, TlsEntry { data: Default::default(), dtor }).unwrap();
7474
trace!("New TLS key allocated: {} with dtor {:?}", new_key, dtor);
7575

76-
if max_size.bits() < 128 && new_key >= (1u128 << max_size.bits() as u128) {
76+
if max_size.bits() < 128 && new_key >= (1u128 << max_size.bits()) {
7777
throw_unsup_format!("we ran out of TLS key space");
7878
}
7979
Ok(new_key)

src/stacked_borrows/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl Item {
2222
assert!(tag.0.get() <= TAG_MASK);
2323
let packed_tag = tag.0.get();
2424
let packed_perm = perm.to_bits() << PERM_SHIFT;
25-
let packed_protected = (protected as u64) << PROTECTED_SHIFT;
25+
let packed_protected = u64::from(protected) << PROTECTED_SHIFT;
2626

2727
let new = Self(packed_tag | packed_perm | packed_protected);
2828

0 commit comments

Comments
 (0)