about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-06-03 14:35:38 +0900
committerGitHub <noreply@github.com>2021-06-03 14:35:38 +0900
commitad7b56e1f404b0ece418dc3cb14b4e0869aa94dc (patch)
treeeae4f7d79059dc2868bc603591658233ac30f7a4 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent052a3feeeac8d8f8f0ab0288a5e2931757ce764c (diff)
parente2b22b56b843d3262dce8813b8450083c27ee659 (diff)
downloadrust-ad7b56e1f404b0ece418dc3cb14b4e0869aa94dc.tar.gz
rust-ad7b56e1f404b0ece418dc3cb14b4e0869aa94dc.zip
Rollup merge of #85900 - LingMan:pat_mat, r=petrochenkov
Use pattern matching instead of checking lengths explicitly

This piece of code checks that there are exaclty two variants, one having
exactly one field, the other having exactly zero fields. If any of these
conditions is violated, it returns `None`. Otherwise it assigns that one
field's ty to `field_ty`.

Instead of fiddling with indices and length checks explicitly, use pattern
matching to simplify this.

`@rustbot` modify labels +C-cleanup +T-compiler
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions