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");
impl Memcom {
/// Open the memory based communication channel singleton.
pub fn new() -> Result<Arc<Self>, Error> {
INSTANCE.get_or_try_init(Self::open).map(Arc::clone)
@ -81,7 +80,11 @@ impl Memcom {
/// The fast path opens an existing file.
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.
@ -94,7 +97,8 @@ fn create_new() -> Result<Fd, Error> {
temp_file_name.as_str(),
OFlag::O_CREAT | OFlag::O_EXCL | OFlag::O_RDWR | OFlag::O_CLOEXEC,
Mode::from_bits_truncate(0o660),
).map_err(|err| {
)
.map_err(|err| {
format_err!(
"failed to create new in-memory communication file at {} - {}",
temp_file_name,