about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/instsimplify.rs
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_mir_transform/src/instsimplify.rs
parent60d146580c10036ce89e019422c6bc2fd9729b65 (diff)
downloadrust-c4c518d2d496774ecc7a368e826480d1928ed1ab.tar.gz
rust-c4c518d2d496774ecc7a368e826480d1928ed1ab.zip
Use more slice patterns inside the compiler
Diffstat (limited to 'compiler/rustc_mir_transform/src/instsimplify.rs')
-rw-r--r--compiler/rustc_mir_transform/src/instsimplify.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_mir_transform/src/instsimplify.rs b/compiler/rustc_mir_transform/src/instsimplify.rs
index 2fc5f7e536b..1589653968c 100644
--- a/compiler/rustc_mir_transform/src/instsimplify.rs
+++ b/compiler/rustc_mir_transform/src/instsimplify.rs
@@ -264,9 +264,7 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
         };
 
         // It's definitely not a clone if there are multiple arguments
-        if args.len() != 1 {
-            return;
-        }
+        let [arg] = &args[..] else { return };
 
         let Some(destination_block) = *target else { return };
 
@@ -280,7 +278,7 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
 
         // These types are easily available from locals, so check that before
         // doing DefId lookups to figure out what we're actually calling.
-        let arg_ty = args[0].node.ty(self.local_decls, self.tcx);
+        let arg_ty = arg.node.ty(self.local_decls, self.tcx);
 
         let ty::Ref(_region, inner_ty, Mutability::Not) = *arg_ty.kind() else { return };