Sisu
E0054

Conversion to the type the value already has

ErrorSafe fix

Built from the repository at commit a8614dc.

i64(x) converts a u8 or a char to an i64, f64(x) converts an i64 to an f64, and u8(x) and char(x) convert an i64 to a u8? or a char?, which is None when the value does not fit. string(x) builds a string from a [char]. Its argument must have one of the other types.

The fix removes the conversion, and keeps the parentheses around an argument that is more than one term: i64(n + 1) * 2 becomes (n + 1) * 2. Removing a conversion that holds a comment deletes the comment, so that fix is unsafe. A conversion whose argument has a label has no fix: the label is E0055 on its own.

Why

A conversion of a value that already has the type does nothing. It usually means the value's type is not what the program assumes.

Broken

fn main() {
    let n: i64 = 5
    print(i64(n))
}

What sisu says

error[E0054]: `n` is already `i64`
 --> E0054.sisu:3:15
  |
3 |     print(i64(n))
  |               ^
  |
help: remove the conversion
  |
3 -     print(i64(n))
3 +     print(n)
  |

sisu: 1 error
sisu: for more on a code, run `sisu explain <code>`: E0054

Fixed

fn main() {
    let n: i64 = 5
    print(n)
}