Skip to content

Commit 2876988

Browse files
committed
Pin parking_lot_core/lock_api & resolve clippy::unnecessary_unwrap
This commit: 1. Pins **indirect** dependencies * parking_lot_core to 0.9.11 * lock_api to 0.4.13 by adding them to our "dev-dependencies" list. Newer versions of them require MSRV 1.71 [1][2], which is higher than our current one 1.69.0 2. Bumps bitflags to 2.4, which is required after doing 1, or we have a dependency conflict 3. Resolves Clippy warning "clippy::unnecessary_unwrap" [3] [1]: https://crates.io/crates/parking_lot_core/0.9.12 [2]: https://crates.io/crates/lock_api/0.4.14 [3]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap
1 parent e1e630f commit 2876988

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

Cargo.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ targets = [
2929

3030
[dependencies]
3131
libc = { version = "=0.2.175", features = ["extra_traits"] }
32-
bitflags = "2.3.3"
32+
bitflags = "2.4"
3333
cfg-if = "1.0"
3434
pin-utils = { version = "0.1.0", optional = true }
3535
memoffset = { version = "0.9", optional = true }
@@ -78,6 +78,15 @@ parking_lot = "0.12"
7878
rand = "0.9"
7979
tempfile = "3.7.1"
8080
semver = "1.0.7"
81+
82+
# parking_lot_core and lock_api are indirect dependencies, so they normally should
83+
# not appear here. However, we include them because we want Cargo to pick the exact
84+
# version that we choose here when resolving dependencies. Newer versions of them
85+
# require MSRV 1.71, our current MSRV is 1.69.
86+
parking_lot_core = "=0.9.11"
87+
lock_api = "=0.4.13"
88+
89+
# To make IDE/LSP work better
8190
nix = { path = ".", features = ["acct", "aio", "dir", "env", "event", "fanotify",
8291
"feature", "fs", "hostname", "inotify", "ioctl", "kmod", "mman", "mount", "mqueue",
8392
"net", "personality", "poll", "pthread", "ptrace", "quota", "process", "reboot",

src/fcntl.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,8 +1041,10 @@ pub struct Flock<T: Flockable>(T);
10411041
impl<T: Flockable> Drop for Flock<T> {
10421042
fn drop(&mut self) {
10431043
let res = Errno::result(unsafe { libc::flock(self.0.as_raw_fd(), libc::LOCK_UN) });
1044-
if res.is_err() && !std::thread::panicking() {
1045-
panic!("Failed to remove flock: {}", res.unwrap_err());
1044+
if let Err(e) = res {
1045+
if !std::thread::panicking() {
1046+
panic!("Failed to remove flock: {}", e);
1047+
}
10461048
}
10471049
}
10481050
}

0 commit comments

Comments
 (0)