about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-10-05 09:39:25 +0000
committerbors <bors@rust-lang.org>2024-10-05 09:39:25 +0000
commit3b418b1485f991946d79befb52a2b1b45f522357 (patch)
tree752624347de025e8d8423fcabc11b0f74f8bd7ce /compiler/rustc_mir_transform/src
parenteb97047cc67adcae7125e30901cb3f69e94b93b3 (diff)
parentf46e1624cbee1558cccf10f0b392ea22c4165e45 (diff)
downloadrust-3b418b1485f991946d79befb52a2b1b45f522357.tar.gz
rust-3b418b1485f991946d79befb52a2b1b45f522357.zip
Auto merge of #3940 - rust-lang:refutable_slice, r=RalfJung
Prefer refutable slice patterns over len check + index op

Just something I noticed while reviewing other PRs

We do it for shim arguments almost everywhere, but when the size is not statically known, we didn't use the helpers as they rely on array ops. But we can avoid a len check followed by several index ops by just using a refutable slice pattern with `let else`.

The pattern is so common, it seems almost worth a dedicated macro
Diffstat (limited to 'compiler/rustc_mir_transform/src')
0 files changed, 0 insertions, 0 deletions