Replace as casts with type-conversion functions.

https://github.com/rust-lang-nursery/rust-clippy/wiki#cast_lossless
This commit is contained in:
Dan Gohman
2018-02-21 12:35:37 -08:00
parent e943d932b9
commit af154655d7
2 changed files with 2 additions and 2 deletions

View File

@@ -106,7 +106,7 @@ fn put_i<CS: CodeSink + ?Sized>(bits: u16, rs1: RegUnit, imm: i64, rd: RegUnit,
///
/// Encoding bits: `opcode[6:2] | (funct3 << 5)`
fn put_u<CS: CodeSink + ?Sized>(bits: u16, imm: i64, rd: RegUnit, sink: &mut CS) {
let bits = bits as u32;
let bits = u32::from(bits);
let opcode5 = bits & 0x1f;
let rd = u32::from(rd) & 0x1f;