Skip to content

Commit

Permalink
Use subslice pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jul 17, 2020
1 parent 0306ffb commit 47a0f69
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ impl EarlyProps {
.take(3) // 3 or more = invalid, so take at most 3.
.collect::<Vec<Option<u32>>>();

match range_components.len() {
1 => {
let v = range_components[0].unwrap();
match *range_components {
[v] => {
let v = v.unwrap();
(v, v)
}
2 => {
let v_min = range_components[0].unwrap();
let v_max = range_components[1].expect(ERROR_MESSAGE);
[min, max] => {
let v_min = min.unwrap();
let v_max = max.expect(ERROR_MESSAGE);
(v_min, v_max)
}
_ => panic!(ERROR_MESSAGE),
Expand Down

0 comments on commit 47a0f69

Please sign in to comment.