about summary refs log tree commit diff
path: root/compiler/rustc_query_system
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-08-07 12:41:49 +0200
committerLeón Orell Valerian Liehr <me@fmease.dev>2024-08-07 13:37:52 +0200
commitc4c518d2d496774ecc7a368e826480d1928ed1ab (patch)
tree71e199c5e79d70938c20c1f8fa3b3a892cc99245 /compiler/rustc_query_system
parent60d146580c10036ce89e019422c6bc2fd9729b65 (diff)
downloadrust-c4c518d2d496774ecc7a368e826480d1928ed1ab.tar.gz
rust-c4c518d2d496774ecc7a368e826480d1928ed1ab.zip
Use more slice patterns inside the compiler
Diffstat (limited to 'compiler/rustc_query_system')
-rw-r--r--compiler/rustc_query_system/src/dep_graph/debug.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/debug.rs b/compiler/rustc_query_system/src/dep_graph/debug.rs
index 4d009d63de5..12ed5742711 100644
--- a/compiler/rustc_query_system/src/dep_graph/debug.rs
+++ b/compiler/rustc_query_system/src/dep_graph/debug.rs
@@ -46,15 +46,14 @@ pub struct EdgeFilter {
 
 impl EdgeFilter {
     pub fn new(test: &str) -> Result<EdgeFilter, Box<dyn Error>> {
-        let parts: Vec<_> = test.split("->").collect();
-        if parts.len() != 2 {
-            Err(format!("expected a filter like `a&b -> c&d`, not `{test}`").into())
-        } else {
+        if let [source, target] = *test.split("->").collect::<Vec<_>>() {
             Ok(EdgeFilter {
-                source: DepNodeFilter::new(parts[0]),
-                target: DepNodeFilter::new(parts[1]),
+                source: DepNodeFilter::new(source),
+                target: DepNodeFilter::new(target),
                 index_to_node: Lock::new(FxHashMap::default()),
             })
+        } else {
+            Err(format!("expected a filter like `a&b -> c&d`, not `{test}`").into())
         }
     }