-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
const TEN: u8 = 10;
const ALSO_TEN: u16 = TEN;The compiler suggests .into() instead of an as-cast:
error[E0308]: mismatched types
--> src/main.rs:2:23
|
2 | const ALSO_TEN: u16 = TEN;
| ^^^ expected u16, found u8
help: you can cast an `u8` to `u16`, which will zero-extend the source value
|
2 | const ALSO_TEN: u16 = TEN.into();
| ^^^^^^^^^^
Normally I'm all about phasing out as, and we should somehow make .into() callable on consts, but right now it's suggesting invalid code.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints