about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-05-25 14:29:55 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2023-05-25 14:29:55 +1000
commited216e2f22896e753f481f40f876e1197c0de43d (patch)
treeffa73e72ce64bbd5c662f7011003d972f26558e9 /compiler
parent86754cd8f280657d75b7dbae1845fa2c45ad28a9 (diff)
downloadrust-ed216e2f22896e753f481f40f876e1197c0de43d.tar.gz
rust-ed216e2f22896e753f481f40f876e1197c0de43d.zip
Streamline `modify_size_estimate`.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_middle/src/mir/mono.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/mir/mono.rs b/compiler/rustc_middle/src/mir/mono.rs
index ff54ec56a29..f31b343c947 100644
--- a/compiler/rustc_middle/src/mir/mono.rs
+++ b/compiler/rustc_middle/src/mir/mono.rs
@@ -334,10 +334,7 @@ impl<'tcx> CodegenUnit<'tcx> {
     }
 
     pub fn modify_size_estimate(&mut self, delta: usize) {
-        assert!(self.size_estimate.is_some());
-        if let Some(size_estimate) = self.size_estimate {
-            self.size_estimate = Some(size_estimate + delta);
-        }
+        *self.size_estimate.as_mut().unwrap() += delta;
     }
 
     pub fn contains_item(&self, item: &MonoItem<'tcx>) -> bool {