diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-06-28 14:09:51 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-06-29 11:51:00 +1000 |
| commit | 8d7084d65fc3c1956b0c1459d26cb5fa9b811525 (patch) | |
| tree | 3f518f0108fa75f2cae593271e13ab5934889298 /compiler/rustc_codegen_llvm/src/builder.rs | |
| parent | 81436ebd55e3512282bb3954e8fb2a936f1ef495 (diff) | |
| download | rust-8d7084d65fc3c1956b0c1459d26cb5fa9b811525.tar.gz rust-8d7084d65fc3c1956b0c1459d26cb5fa9b811525.zip | |
Simplify the `bundles` vectors.
After the last commit, they contain `Option<&OperandBundleDef<'a>>` but
the values are always `Some(_)`. This commit removes the needless
`Option` wrapper. This also simplifies the type signatures of
`LLVMRustBuild{Invoke,Call}`, which were relying on the fact that the
represention of `Option<&T>` is the same as `&T` for non-`None` values.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/builder.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/builder.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index 2a4bb1709df..3df7a7c9c5a 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -227,7 +227,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { let funclet_bundle = funclet.map(|funclet| funclet.bundle()); let funclet_bundle = funclet_bundle.as_ref().map(|b| &*b.raw); let mut bundles: SmallVec<[_; 2]> = SmallVec::new(); - if funclet_bundle.is_some() { + if let Some(funclet_bundle) = funclet_bundle { bundles.push(funclet_bundle); } @@ -237,7 +237,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { // Emit KCFI operand bundle let kcfi_bundle = self.kcfi_operand_bundle(fn_attrs, fn_abi, llfn); let kcfi_bundle = kcfi_bundle.as_ref().map(|b| &*b.raw); - if kcfi_bundle.is_some() { + if let Some(kcfi_bundle) = kcfi_bundle { bundles.push(kcfi_bundle); } @@ -1195,7 +1195,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { let funclet_bundle = funclet.map(|funclet| funclet.bundle()); let funclet_bundle = funclet_bundle.as_ref().map(|b| &*b.raw); let mut bundles: SmallVec<[_; 2]> = SmallVec::new(); - if funclet_bundle.is_some() { + if let Some(funclet_bundle) = funclet_bundle { bundles.push(funclet_bundle); } @@ -1205,7 +1205,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { // Emit KCFI operand bundle let kcfi_bundle = self.kcfi_operand_bundle(fn_attrs, fn_abi, llfn); let kcfi_bundle = kcfi_bundle.as_ref().map(|b| &*b.raw); - if kcfi_bundle.is_some() { + if let Some(kcfi_bundle) = kcfi_bundle { bundles.push(kcfi_bundle); } |
