]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/literals.rs
Lint literal suffixes not separated by underscores (see #703)
[rust.git] / tests / compile-fail / literals.rs
1 #![feature(plugin)]
2 #![plugin(clippy)]
3 #![deny(mixed_case_hex_literals)]
4 #![deny(unseparated_literal_suffix)]
5 #![allow(dead_code)]
6
7 fn main() {
8     let ok1 = 0xABCD;
9     let ok3 = 0xab_cd;
10     let ok4 = 0xab_cd_i32;
11     let ok5 = 0xAB_CD_u32;
12     let ok5 = 0xAB_CD_isize;
13     let fail1 = 0xabCD;       //~ERROR inconsistent casing in hexadecimal literal
14     let fail2 = 0xabCD_u32;   //~ERROR inconsistent casing in hexadecimal literal
15     let fail2 = 0xabCD_isize; //~ERROR inconsistent casing in hexadecimal literal
16
17     let ok6 = 1234_i32;
18     let ok7 = 1234_f32;
19     let ok8 = 1234_isize;
20     let fail3 = 1234i32;      //~ERROR integer type suffix should be separated
21     let fail4 = 1234u32;      //~ERROR integer type suffix should be separated
22     let fail5 = 1234isize;    //~ERROR integer type suffix should be separated
23     let fail6 = 1234usize;    //~ERROR integer type suffix should be separated
24     let fail7 = 1.5f32;       //~ERROR float type suffix should be separated
25 }