memcom: rustfmt + (trailing) whitespace cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-07-03 20:42:55 +02:00
parent 9a06eb1618
commit 835d0e5dd3
1 changed files with 31 additions and 27 deletions

View File

@ -34,7 +34,6 @@ static INSTANCE: OnceCell<Arc<Memcom>> = OnceCell::new();
const MEMCOM_FILE_PATH: &str = rundir!("/proxmox-backup-memcom"); const MEMCOM_FILE_PATH: &str = rundir!("/proxmox-backup-memcom");
impl Memcom { impl Memcom {
/// Open the memory based communication channel singleton. /// Open the memory based communication channel singleton.
pub fn new() -> Result<Arc<Self>, Error> { pub fn new() -> Result<Arc<Self>, Error> {
INSTANCE.get_or_try_init(Self::open).map(Arc::clone) INSTANCE.get_or_try_init(Self::open).map(Arc::clone)
@ -81,7 +80,11 @@ impl Memcom {
/// The fast path opens an existing file. /// The fast path opens an existing file.
fn open_existing() -> Result<Fd, nix::Error> { fn open_existing() -> Result<Fd, nix::Error> {
Fd::open(MEMCOM_FILE_PATH, OFlag::O_RDWR | OFlag::O_CLOEXEC, Mode::empty()) Fd::open(
MEMCOM_FILE_PATH,
OFlag::O_RDWR | OFlag::O_CLOEXEC,
Mode::empty(),
)
} }
/// Since we need to initialize the file, we also need a solid slow path where we create the file. /// Since we need to initialize the file, we also need a solid slow path where we create the file.
@ -94,7 +97,8 @@ fn create_new() -> Result<Fd, Error> {
temp_file_name.as_str(), temp_file_name.as_str(),
OFlag::O_CREAT | OFlag::O_EXCL | OFlag::O_RDWR | OFlag::O_CLOEXEC, OFlag::O_CREAT | OFlag::O_EXCL | OFlag::O_RDWR | OFlag::O_CLOEXEC,
Mode::from_bits_truncate(0o660), Mode::from_bits_truncate(0o660),
).map_err(|err| { )
.map_err(|err| {
format_err!( format_err!(
"failed to create new in-memory communication file at {} - {}", "failed to create new in-memory communication file at {} - {}",
temp_file_name, temp_file_name,