mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 12:33:33 +00:00
happy slice
This commit is contained in:
parent
8deadb18ae
commit
5e4370fe56
1 changed files with 35 additions and 0 deletions
|
@ -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",
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue