Skip to content

Commit

Permalink
chore: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
oblique committed Feb 28, 2024
1 parent c521d22 commit 4e9f9c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
7 changes: 4 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
//! }
//! ```
use once_cell::sync::Lazy;
use parking_lot::lock_api::ArcMutexGuard;
use parking_lot::{Mutex, RawMutex};
use std::collections::HashMap;
use std::fmt;
#[cfg(unix)]
use std::path::{Path, PathBuf};
use std::sync::{Arc, Weak};

use once_cell::sync::Lazy;
use parking_lot::lock_api::ArcMutexGuard;
use parking_lot::{Mutex, RawMutex};

mod error;
#[cfg(unix)]
mod unix;
Expand Down
3 changes: 2 additions & 1 deletion src/unix.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use libc::{LOCK_EX, LOCK_NB, LOCK_UN};
use std::fs::{File, OpenOptions};
use std::io;
use std::os::unix::io::{AsRawFd, RawFd};
use std::path::Path;

use libc::{LOCK_EX, LOCK_NB, LOCK_UN};

use crate::error::*;

#[derive(Debug)]
Expand Down
20 changes: 9 additions & 11 deletions src/windows.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use windows::{
core::HSTRING,
Win32::{
Foundation::{
CloseHandle, HANDLE, WAIT_ABANDONED, WAIT_OBJECT_0, WAIT_TIMEOUT,
},
System::Threading::{
CreateMutexW, ReleaseMutex, WaitForSingleObject, INFINITE,
},
},
use std::io;

use windows::core::HSTRING;
use windows::System::Threading::{
CreateMutexW, ReleaseMutex, WaitForSingleObject, INFINITE,
};
use windows::Win32::Foundation::{
CloseHandle, HANDLE, WAIT_ABANDONED, WAIT_OBJECT_0, WAIT_TIMEOUT,
};

use crate::error::*;
Expand All @@ -24,7 +22,7 @@ impl RawNamedLock {
pub(crate) fn create(name: &str) -> Result<RawNamedLock> {
let handle = unsafe {
CreateMutexW(None, false, &HSTRING::from(name))
.map_err(|e| Error::CreateFailed(std::io::Error::from(e)))?
.map_err(|e| Error::CreateFailed(io::Error::from(e)))?
};

Ok(RawNamedLock {
Expand Down

0 comments on commit 4e9f9c7

Please sign in to comment.