about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm
diff options
context:
space:
mode:
authorRich Kadel <richkadel@google.com>2020-10-23 14:58:08 -0700
committerGitHub <noreply@github.com>2020-10-23 14:58:08 -0700
commitf75a236fe0751a0d9bfb740c32eec14da787f112 (patch)
tree4ff4779ab1bcb108aab355e53504b52ca89c698c /compiler/rustc_codegen_llvm
parenta7bc1a2edf6066c16b01f40a2a0120c9d6ff4a49 (diff)
downloadrust-f75a236fe0751a0d9bfb740c32eec14da787f112.tar.gz
rust-f75a236fe0751a0d9bfb740c32eec14da787f112.zip
Update compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
Co-authored-by: Wesley Wiser <wwiser@gmail.com>
Diffstat (limited to 'compiler/rustc_codegen_llvm')
-rw-r--r--compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
index 94ef33ac5b4..c1163a871cf 100644
--- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
+++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
@@ -26,10 +26,10 @@ use tracing::debug;
 /// undocumented details in Clang's implementation (that may or may not be important) were also
 /// replicated for Rust's Coverage Map.
 pub fn finalize<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {
-    if cx.coverage_context().is_none() {
-        return;
-    }
-    let function_coverage_map = cx.coverage_context().unwrap().take_function_coverage_map();
+    let function_coverage_map = match cx.coverage_context() {
+        Some(ctx) => ctx.take_function_coverage_map(),
+        None => return,
+    };
     if function_coverage_map.is_empty() {
         // This module has no functions with coverage instrumentation
         return;