fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1// When a SINGLE-character string literal is used where a char should be, 2// suggest changing to single quotes. 3 4// Testing both single-byte and multi-byte characters, as we should handle both. 5 6// run-rustfix 7 8fn main() { 9 let _: char = 'a'; //~ ERROR mismatched types 10 let _: char = '人'; //~ ERROR mismatched types 11 let _: char = '\''; //~ ERROR mismatched types 12} 13 14// regression test for https://github.com/rust-lang/rust/issues/109586 15#[allow(dead_code)] 16fn convert_c_to_str(c: char) { 17 match c { 18 'A' => {} //~ ERROR mismatched types 19 _ => {} 20 } 21}