about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLzu Tao <taolzu@gmail.com>2020-07-11 13:50:46 +0000
committerLzu Tao <taolzu@gmail.com>2020-07-19 09:29:11 +0000
commit5aa33b11fc88d0f81c7b2dc586db1439fcf2b664 (patch)
tree6c620b3519a454109ec3348e26d1a025dee21fc6
parent75caee076d41eca5163a4094e44ce6d48f6b4f1b (diff)
downloadrust-5aa33b11fc88d0f81c7b2dc586db1439fcf2b664.tar.gz
rust-5aa33b11fc88d0f81c7b2dc586db1439fcf2b664.zip
Use subslice pattern
-rw-r--r--src/tools/compiletest/src/header.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index dc561352642..e155a924990 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -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),