changeset 482:6d48f2046c29

rustfmt
author Lewin Bormann <lbo@spheniscida.de>
date Fri, 19 Jul 2019 14:36:28 +0200
parents 2190a3c01f1e
children fa62d1f60a02
files src/disk_env.rs
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/disk_env.rs	Fri Jul 19 14:36:21 2019 +0200
+++ b/src/disk_env.rs	Fri Jul 19 14:36:28 2019 +0200
@@ -128,13 +128,14 @@
                 .map_err(|e| map_err_with_name("lock", p, e))?;
 
             let fd = f.into_raw_fd();
-            let result = unsafe {
-                libc::flock(fd as libc::c_int, libc::LOCK_EX | libc::LOCK_NB)
-            };
+            let result = unsafe { libc::flock(fd as libc::c_int, libc::LOCK_EX | libc::LOCK_NB) };
 
             if result < 0 {
                 if errno::errno() == errno::Errno(libc::EWOULDBLOCK) {
-                    return Err(Status::new(StatusCode::LockError, "lock on database is already held by different process"))
+                    return Err(Status::new(
+                        StatusCode::LockError,
+                        "lock on database is already held by different process",
+                    ));
                 }
                 return Err(Status::new(
                     StatusCode::Errno(errno::errno()),
@@ -160,8 +161,9 @@
             let fd = locks.remove(&l.id).unwrap();
             let result = unsafe {
                 let ok = libc::fcntl(fd, libc::F_GETFD);
-                if ok < 0 { // Likely EBADF when already closed. In that case, the lock is released and all is fine.
-                    return Ok(())
+                if ok < 0 {
+                    // Likely EBADF when already closed. In that case, the lock is released and all is fine.
+                    return Ok(());
                 }
                 libc::flock(fd, libc::LOCK_UN)
             };