Bug 1557176 - Clippy fix for kvstore r=myk
authorNan Jiang <njiang028@gmail.com>
Thu, 06 Jun 2019 23:02:51 +0000
changeset 477745 a30adf37aef0b35d8e777c03cd712b891054628a
parent 477744 56449fd37aee9aaf1faf0aeefab2cd80d6c20d03
child 477746 aae7e4d626d364f3a02bcd2ce3c9ad4b4723ac45
push id113372
push userdvarga@mozilla.com
push dateFri, 07 Jun 2019 10:07:35 +0000
treeherdermozilla-inbound@9909cd207cc2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmyk
bugs1557176
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1557176 - Clippy fix for kvstore r=myk Differential Revision: https://phabricator.services.mozilla.com/D33984
toolkit/components/kvstore/src/task.rs
--- a/toolkit/components/kvstore/src/task.rs
+++ b/toolkit/components/kvstore/src/task.rs
@@ -127,23 +127,22 @@ fn round_to_pagesize(size: usize) -> usi
 /// It either increases the size in double, or by a constant size if its size
 /// reaches INCREMENTAL_RESIZE_THRESHOLD.
 ///
 /// Note that on Linux / MAC OSX, the increased size would only take effect if
 /// there is a write transaction committed afterwards.
 fn active_resize(env: &Rkv) -> Result<(), StoreError> {
     let info = env.info()?;
     let current_size = info.map_size();
-    let size;
 
-    if current_size < INCREMENTAL_RESIZE_THRESHOLD {
-        size = current_size << 1;
+    let size = if current_size < INCREMENTAL_RESIZE_THRESHOLD {
+        current_size << 1
     } else {
-        size = current_size + INCREMENTAL_RESIZE_STEP;
-    }
+        current_size + INCREMENTAL_RESIZE_STEP
+    };
 
     env.set_map_size(size)?;
     Ok(())
 }
 
 /// Passive resizing that is performed when the MAP_FULL error occurs. It
 /// increases the store with a `wanted` size.
 ///