You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of rust-lang#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
0 commit comments