diff options
| author | LingMan <LingMan@users.noreply.github.com> | 2021-06-01 18:09:29 +0200 |
|---|---|---|
| committer | LingMan <LingMan@users.noreply.github.com> | 2021-06-01 22:31:46 +0200 |
| commit | e2b22b56b843d3262dce8813b8450083c27ee659 (patch) | |
| tree | 3d7e0e7bb730fdc476eacf7607d2b3b4fc31c8f0 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 1160cf864f2a0014e3442367e1b96496bfbeadf4 (diff) | |
| download | rust-e2b22b56b843d3262dce8813b8450083c27ee659.tar.gz rust-e2b22b56b843d3262dce8813b8450083c27ee659.zip | |
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.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
