Skip to content

Commit 42141b6

Browse files
committed
Small fixes
1 parent bdeb23f commit 42141b6

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

crates/tmc-langs-util/src/file_util.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ impl LockOptions {
4141
let mut opts = OpenOptions::new();
4242
match self {
4343
Self::Read => opts.read(true),
44-
Self::ReadCreate => opts.read(true).create(true),
44+
// create requires write
45+
Self::ReadCreate => opts.read(true).write(true).create(true),
4546
// truncate requires write
4647
Self::ReadTruncate => opts.write(true).truncate(true),
4748
Self::Write => opts.write(true),

crates/tmc-langs-util/src/file_util/lock_unix.rs

-13
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@ use std::{
1111
path::{Path, PathBuf},
1212
};
1313

14-
/// Blocks until the lock can be acquired.
15-
#[derive(Debug)]
16-
pub struct LockA {
17-
pub path: PathBuf,
18-
}
19-
20-
impl LockA {
21-
pub fn new(path: impl AsRef<Path>) -> Self {
22-
let path = path.as_ref().to_path_buf();
23-
Self { path }
24-
}
25-
}
26-
2714
/// Blocks until the lock can be acquired.
2815
#[derive(Debug)]
2916
pub struct Lock {

crates/tmc-langs-util/src/file_util/lock_windows.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,11 @@ mod test {
246246
let temp = tempfile::tempdir().unwrap();
247247
let mut lock = Lock::dir(temp.path().to_path_buf(), LockOptions::Read).unwrap();
248248
let lock_path = temp.path().join(".tmc.lock");
249-
assert!(!lock_path.exists());
249+
assert!(lock_path.exists());
250250
let guard = lock.lock().unwrap();
251251
assert!(lock_path.exists());
252252
drop(guard);
253+
drop(lock);
253254
assert!(!lock_path.exists());
254255
}
255256
}

0 commit comments

Comments
 (0)