about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorIgor Matuszewski <Xanewok@gmail.com>2019-06-26 14:04:37 +0200
committerIgor Matuszewski <Xanewok@gmail.com>2019-06-26 14:11:58 +0200
commit6c93b47c010f09d6f1ec8303898984944fdbd6f0 (patch)
tree9a3914bbc710c98e12a2c89f8980f5d3a5dcb8b6 /src/librustc_data_structures
parent12806b70506508c4ec187f0223e1e86f89167448 (diff)
Fix clippy::cast_losless
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/fingerprint.rs4
-rw-r--r--src/librustc_data_structures/sip128.rs6
-rw-r--r--src/librustc_data_structures/stable_hasher.rs2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/librustc_data_structures/fingerprint.rs b/src/librustc_data_structures/fingerprint.rs
index c4c0db58012..7975c62b90f 100644
--- a/src/librustc_data_structures/fingerprint.rs
+++ b/src/librustc_data_structures/fingerprint.rs
@@ -39,8 +39,8 @@ impl Fingerprint {
     // you want.
     #[inline]
     pub fn combine_commutative(self, other: Fingerprint) -> Fingerprint {
-        let a = (self.1 as u128) << 64 | self.0 as u128;
-        let b = (other.1 as u128) << 64 | other.0 as u128;
+        let a = u128::from(self.1) << 64 | u128::from(self.0);
+        let b = u128::from(other.1) << 64 | u128::from(other.0);
 
         let c = a.wrapping_add(b);
 
diff --git a/src/librustc_data_structures/sip128.rs b/src/librustc_data_structures/sip128.rs
index 06f157f9729..7838a900890 100644
--- a/src/librustc_data_structures/sip128.rs
+++ b/src/librustc_data_structures/sip128.rs
@@ -70,15 +70,15 @@ unsafe fn u8to64_le(buf: &[u8], start: usize, len: usize) -> u64 {
     let mut i = 0; // current byte index (from LSB) in the output u64
     let mut out = 0;
     if i + 3 < len {
-        out = load_int_le!(buf, start + i, u32) as u64;
+        out = u64::from(load_int_le!(buf, start + i, u32));
         i += 4;
     }
     if i + 1 < len {
-        out |= (load_int_le!(buf, start + i, u16) as u64) << (i * 8);
+        out |= u64::from(load_int_le!(buf, start + i, u16)) << (i * 8);
         i += 2
     }
     if i < len {
-        out |= (*buf.get_unchecked(start + i) as u64) << (i * 8);
+        out |= u64::from(*buf.get_unchecked(start + i)) << (i * 8);
         i += 1;
     }
     debug_assert_eq!(i, len);
diff --git a/src/librustc_data_structures/stable_hasher.rs b/src/librustc_data_structures/stable_hasher.rs
index 0c81c27a96e..47dfc1d1688 100644
--- a/src/librustc_data_structures/stable_hasher.rs
+++ b/src/librustc_data_structures/stable_hasher.rs
@@ -44,7 +44,7 @@ impl<W: StableHasherResult> StableHasher<W> {
 impl StableHasherResult for u128 {
     fn finish(hasher: StableHasher<Self>) -> Self {
         let (_0, _1) = hasher.finalize();
-        (_0 as u128) | ((_1 as u128) << 64)
+        u128::from(_0) | (u128::from(_1) << 64)
     }
 }