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
2017-07-13 16:37:07 -07:00
parent af74cdf364
commit 0cacba15b9
12 changed files with 42 additions and 34 deletions

View File

@@ -171,8 +171,8 @@ U = EncRecipe(
UJ = EncRecipe(
'UJ', Jump, size=4, ins=(), outs=(), branch_range=(0, 21),
emit='''
let dest = func.offsets[destination] as i64;
let disp = dest - sink.offset() as i64;
let dest = i64::from(func.offsets[destination]);
let disp = dest - i64::from(sink.offset());
put_uj(bits, disp, 0, sink);
''')
@@ -190,8 +190,8 @@ SB = EncRecipe(
ins=(GPR, GPR), outs=(),
branch_range=(0, 13),
emit='''
let dest = func.offsets[destination] as i64;
let disp = dest - sink.offset() as i64;
let dest = i64::from(func.offsets[destination]);
let disp = dest - i64::from(sink.offset());
put_sb(bits, disp, in_reg0, in_reg1, sink);
''')
@@ -201,8 +201,8 @@ SBzero = EncRecipe(
ins=(GPR), outs=(),
branch_range=(0, 13),
emit='''
let dest = func.offsets[destination] as i64;
let disp = dest - sink.offset() as i64;
let dest = i64::from(func.offsets[destination]);
let disp = dest - i64::from(sink.offset());
put_sb(bits, disp, in_reg0, 0, sink);
''')