summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2019-06-12 15:04:01 +0200
committerLinus Färnstrand <linus@mullvad.net>2019-06-12 15:17:07 +0200
commitede2714f675fb12c022e16ae12bf1fde2546122a (patch)
tree9e9c396c1bc5674f00ce7d19e1dbabcdf409eed8
parentc40985c66514cc7f60e5d2e32d2e0ea3526251c2 (diff)
downloadmullvadvpn-ede2714f675fb12c022e16ae12bf1fde2546122a.tar.xz
mullvadvpn-ede2714f675fb12c022e16ae12bf1fde2546122a.zip
Use *_or_else with closure
-rw-r--r--mullvad-daemon/src/account_history.rs2
-rw-r--r--mullvad-daemon/src/lib.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/mullvad-daemon/src/account_history.rs b/mullvad-daemon/src/account_history.rs
index d1ef1d9efd..c8bb92c7a9 100644
--- a/mullvad-daemon/src/account_history.rs
+++ b/mullvad-daemon/src/account_history.rs
@@ -83,7 +83,7 @@ impl AccountHistory {
reader.seek(io::SeekFrom::Start(0)).map_err(Error::Read)?;
Ok(serde_json::from_reader(reader)
.map(|old_format: OldFormat| old_format.accounts)
- .unwrap_or(vec![]))
+ .unwrap_or_else(|_| Vec::new()))
}
/// Gets account data for a certain account id and bumps it's entry to the top of the list if
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs
index 0d2cb7f551..f1383d622e 100644
--- a/mullvad-daemon/src/lib.rs
+++ b/mullvad-daemon/src/lib.rs
@@ -1021,7 +1021,7 @@ where
let account_token = self
.settings
.get_account_token()
- .ok_or("No account token set".to_string())?;
+ .ok_or_else(|| "No account token set".to_owned())?;
let mut account_entry = self
.account_history