Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ cfg-if = "1.0.0"
clap = "4.5.13"
clap-cargo = "0.14.1"
clap-verbosity-flag = "3.0.2"
fs4 = "0.12.0"
include_dir = "0.7.4"
itertools = "0.13.0"
mockall = "0.13.1"
Expand Down
1 change: 0 additions & 1 deletion crates/cargo-wdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ anyhow.workspace = true
cargo_metadata.workspace = true
clap = { workspace = true, features = ["derive"] }
clap-verbosity-flag.workspace = true
fs4.workspace = true
include_dir.workspace = true
mockall.workspace = true
mockall_double.workspace = true
Expand Down
7 changes: 4 additions & 3 deletions crates/cargo-wdk/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

#![allow(clippy::literal_string_with_formatting_args)]

use fs4::fs_std::FileExt;
// File locking APIs were stabilized in std::fs::File in Rust 1.89.0
// See: https://github.com/rust-lang/rust/issues/130994

/// Sets the `RUSTFLAGS` environment variable to include `+crt-static`.
///
Expand Down Expand Up @@ -39,7 +40,7 @@ where
{
let lock_file = std::fs::File::create("cargo-wdk-test.lock")
.expect("Unable to create lock file for cargo-wdk tests");
FileExt::lock_exclusive(&lock_file).expect("Unable to cargo-wdk-test.lock file");
lock_file.lock_exclusive().expect("Unable to lock cargo-wdk-test.lock file");
f();
FileExt::unlock(&lock_file).expect("Unable to unlock cargo-wdk-test.lock file");
lock_file.unlock().expect("Unable to unlock cargo-wdk-test.lock file");
}
1 change: 0 additions & 1 deletion crates/wdk-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ nightly = []

[dependencies]
cfg-if.workspace = true
fs4.workspace = true
itertools.workspace = true
proc-macro2.workspace = true
quote.workspace = true
Expand Down
11 changes: 6 additions & 5 deletions crates/wdk-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

use std::{collections::BTreeMap, path::PathBuf, str::FromStr};

use fs4::fs_std::FileExt;
// File locking APIs were stabilized in std::fs::File in Rust 1.89.0
// See: https://github.com/rust-lang/rust/issues/130994
use itertools::Itertools;
use proc_macro::TokenStream;
use proc_macro2::{Span, TokenStream as TokenStream2};
Expand Down Expand Up @@ -122,14 +123,14 @@ struct FileLockGuard {

impl FileLockGuard {
fn new(file: std::fs::File, span: Span) -> Result<Self> {
FileExt::lock_exclusive(&file).to_syn_result(span, "unable to obtain file lock")?;
file.lock_exclusive().to_syn_result(span, "unable to obtain file lock")?;
Ok(Self { file })
}
}

impl Drop for FileLockGuard {
fn drop(&mut self) {
let _ = FileExt::unlock(&self.file);
let _ = self.file.unlock();
}
}

Expand Down Expand Up @@ -976,7 +977,7 @@ mod tests {
{
let test_flock: std::fs::File =
std::fs::File::create(SCRATCH_DIR.join("test.lock")).unwrap();
FileExt::lock_exclusive(&test_flock).unwrap();
test_flock.lock_exclusive().unwrap();

let cached_function_info_map_path = SCRATCH_DIR.join(CACHE_FILE_NAME);

Expand All @@ -993,7 +994,7 @@ mod tests {
std::fs::remove_file(cached_function_info_map_path).unwrap();
}

FileExt::unlock(&test_flock).unwrap();
test_flock.unlock().unwrap();
}

mod to_snake_case {
Expand Down
1 change: 0 additions & 1 deletion tests/wdk-macros-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ publish = false
[lib]

[dependencies]
fs4 = { version = "0.13.1", features = ["sync"] }
macrotest = "1.0.13"
owo-colors = "4.2.0"
paste = "1.0.15"
Expand Down
5 changes: 3 additions & 2 deletions tests/wdk-macros-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

use std::{path::PathBuf, sync::LazyLock};

use fs4::fs_std::FileExt;
// File locking APIs were stabilized in std::fs::File in Rust 1.89.0
// See: https://github.com/rust-lang/rust/issues/130994
pub use macrotest::{expand, expand_args};
pub use owo_colors::OwoColorize;
pub use paste::paste;
Expand Down Expand Up @@ -270,7 +271,7 @@ pub fn _create_symlink_if_nonexistent(link: &std::path::Path, target: &std::path

// explicitly unlock the target_file to avoid waiting for windows to eventually
// automatically release the lock when target_file handle is closed
FileExt::unlock(&target_file)
target_file.unlock()
.expect("file locks should be successfully released");
}
}
Loading