summaryrefslogtreecommitdiffhomepage
path: root/talpid-core
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-09-13 12:33:53 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-09-13 19:40:27 +0200
commitb6980f9dfa45f358daba0bd3488c6616ddcc0643 (patch)
tree4da3b1d9e711f95bb6f137e9ef4fdea701ad2a77 /talpid-core
parentd2138880b974a99d2d8947976e7d2e86b4e395fa (diff)
downloadmullvadvpn-b6980f9dfa45f358daba0bd3488c6616ddcc0643.tar.xz
mullvadvpn-b6980f9dfa45f358daba0bd3488c6616ddcc0643.zip
Use if let in rotate_log for simpler code
Diffstat (limited to 'talpid-core')
-rw-r--r--talpid-core/src/logging.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/talpid-core/src/logging.rs b/talpid-core/src/logging.rs
index fe77297b84..5b5d4ddfbe 100644
--- a/talpid-core/src/logging.rs
+++ b/talpid-core/src/logging.rs
@@ -9,11 +9,11 @@ error_chain!{}
/// it is backed up with the extension changed to `.old.log`.
pub fn rotate_log(file: &Path) -> Result<()> {
let backup = file.with_extension("old.log");
- fs::rename(file, backup).unwrap_or_else(|error| {
+ if let Err(error) = fs::rename(file, backup) {
if error.kind() != io::ErrorKind::NotFound {
warn!("Failed to rotate log file ({})", error);
}
- });
+ }
fs::File::create(file).chain_err(|| "Unable to create new log file")?;
Ok(())