happy slice

This commit is contained in:
Jeroen Vannevel 2022-01-14 01:20:40 +00:00
parent 8deadb18ae
commit 5e4370fe56
No known key found for this signature in database
GPG key ID: 78EF5F52F38C49BD

View file

@ -791,4 +791,39 @@ fn func(binary: &[u8]) {
"#, "#,
) )
} }
#[test]
fn merge_match_arms_slice_identical() {
check_assist(
merge_match_arms,
r#"
fn func(binary: &[u8]) {
let space = b' ';
match binary {
[space, 5u8] => $0"",
[space] => "",
_ => "other",
};
} }
"#,
r#"
fn func(binary: &[u8]) {
let space = b' ';
match binary {
[space, 5u8] | [space] => "",
_ => "other",
};
}
"#,
)
}
}
fn func(binary: &[u8]) {
let space = b' ';
match binary {
[space, 5u8] => "",
[space] => "",
_ => "other",
};
}