rust/tests/ui/char_lit_as_u8.rs

9 lines
258 B
Rust
Raw Normal View History

2018-07-28 10:34:52 -05:00
#![warn(clippy::char_lit_as_u8)]
fn main() {
// no suggestion, since a byte literal won't work.
let _ = '❤' as u8;
//~^ ERROR: casting a character literal to `u8` truncates
//~| NOTE: `char` is four bytes wide, but `u8` is a single byte
}