Add a few more tests of edge cases

This commit is contained in:
Oliver Scherer 2018-12-07 19:06:22 +01:00
parent 8f2ce3d839
commit 8a9414ae19
3 changed files with 37 additions and 0 deletions

View file

@ -21,4 +21,11 @@ fn main() {
MAGIC_TEST => (), // this should warn
_ => (),
}
const FOO: [u32; 1] = [4];
match [99] {
[0x00] => (),
[4] => (),
FOO => (), // this should warn
_ => (),
}
}

View file

@ -21,4 +21,11 @@ fn main() {
MAGIC_TEST => (), // this should warn
_ => (),
}
const FOO: [&str; 1] = ["boo"];
match ["baa"] {
["0x00"] => (),
["boo"] => (),
FOO => (), // this should warn
_ => (),
}
}

View file

@ -21,4 +21,27 @@ fn main() {
MAGIC_TEST => (), // this should warn
_ => (),
}
const FOO: [u8; 1] = [4];
match [99] {
[0x00] => (),
[4] => (),
FOO => (), // this should warn
_ => (),
}
const BAR: &[u8; 1] = &[4];
match &[99] {
[0x00] => (),
[4] => (),
BAR => (), // this should warn
b"a" => (),
_ => (),
}
const BOO: &[u8; 0] = &[];
match &[] {
[] => (),
BOO => (), // this should warn
b"" => (),
_ => (),
}
}