Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 47a0f69

Browse files
committedJul 17, 2020
Use subslice pattern
1 parent 0306ffb commit 47a0f69

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎src/tools/compiletest/src/header.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,14 @@ impl EarlyProps {
170170
.take(3) // 3 or more = invalid, so take at most 3.
171171
.collect::<Vec<Option<u32>>>();
172172

173-
match range_components.len() {
174-
1 => {
175-
let v = range_components[0].unwrap();
173+
match *range_components {
174+
[v] => {
175+
let v = v.unwrap();
176176
(v, v)
177177
}
178-
2 => {
179-
let v_min = range_components[0].unwrap();
180-
let v_max = range_components[1].expect(ERROR_MESSAGE);
178+
[min, max] => {
179+
let v_min = min.unwrap();
180+
let v_max = max.expect(ERROR_MESSAGE);
181181
(v_min, v_max)
182182
}
183183
_ => panic!(ERROR_MESSAGE),

0 commit comments

Comments
 (0)
Please sign in to comment.