Skip to content

Commit c7464d0

Browse files
Fixes for Rust 1.72 (awslabs#479)
* Fixes for Rust 1.72 Signed-off-by: James Bornholt <[email protected]> * Fix tracing Signed-off-by: James Bornholt <[email protected]> --------- Signed-off-by: James Bornholt <[email protected]>
1 parent 6103a2f commit c7464d0

File tree

9 files changed

+34
-15
lines changed

9 files changed

+34
-15
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ members = [
66
"mountpoint-s3",
77
"vendor/fuser",
88
]
9+
resolver = "2"
910

1011
[profile.release]
1112
debug = 2

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ fmt-check:
5757
done; \
5858
exit $$fail
5959

60+
DISABLED_LINTS =
61+
DISABLED_LINTS += -A clippy::items-after-test-module # https://github.com/rust-lang/rust-clippy/issues/11153
62+
DISABLED_LINTS += -A clippy::arc-with-non-send-sync # https://github.com/proptest-rs/proptest/issues/364
63+
6064
.PHONY: clippy
6165
clippy:
6266
@packages=`echo "$(CRATES)" | sed -E 's/(^| )/ -p /g'`; \
63-
cargo clippy $$packages --no-deps --all-targets --all-features -- -D clippy::all -A clippy::items-after-test-module
67+
cargo clippy $$packages --no-deps --all-targets --all-features -- -D clippy::all $(DISABLED_LINTS)

mountpoint-s3-client/tests/put_object.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async fn test_put_object_multi_part(client: &impl ObjectClient, bucket: &str, pr
7474

7575
let key = format!("{prefix}hello");
7676

77-
let mut contents = vec![0u8; 32];
77+
let mut contents = [0u8; 32];
7878
rng.fill(&mut contents[..]);
7979

8080
let mut request = client

mountpoint-s3-crt/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<T> CrtError for *mut T {
8484
type Return = NonNull<T>;
8585

8686
unsafe fn ok_or_last_error(self) -> Result<Self::Return, Error> {
87-
NonNull::new(self as *mut T).ok_or_else(|| Error::last_error())
87+
NonNull::new(self).ok_or_else(|| Error::last_error())
8888
}
8989
}
9090

mountpoint-s3-crt/src/s3/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ unsafe extern "C" fn meta_request_telemetry_callback(
371371
let user_data = MetaRequestOptionsInner::from_user_data_ptr(user_data);
372372

373373
if let Some(callback) = user_data.on_telemetry.as_ref() {
374-
let metrics = NonNull::new(metrics as *mut aws_s3_request_metrics).expect("request metrics is never null");
374+
let metrics = NonNull::new(metrics).expect("request metrics is never null");
375375
let metrics = RequestMetrics { inner: metrics };
376376
// The docs say "`metrics` is only valid for the duration of the callback", so we need to
377377
// pass a reference here.

mountpoint-s3/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ regex = "1.7.1"
2929
supports-color = "2.0.0"
3030
syslog = "6.1.0"
3131
thiserror = "1.0.34"
32-
tracing = { version = "0.1.35", default-features = false, features = ["std", "log"] }
32+
tracing = { version = "0.1.35", default-features = false, features = ["std", "log", "attributes"] }
3333
tracing-log = "0.1.3"
3434
tracing-subscriber = { version = "0.3.14", features = ["fmt", "env-filter"] }
3535
nix = "0.26.2"

mountpoint-s3/src/fuse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ where
582582
name: &OsStr,
583583
newparent: u64,
584584
newname: &OsStr,
585-
options: u64,
585+
_options: u64,
586586
reply: ReplyEmpty,
587587
) {
588588
fuse_unsupported!("exchange", reply);

mountpoint-s3/src/fuse/session.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,17 @@ impl<W: Work> WorkerPool<W> {
137137
/// Try to add a new worker.
138138
/// Returns `Ok(false)` if there are already [`WorkerPool::max_workers`].
139139
fn try_add_worker(&self) -> anyhow::Result<bool> {
140-
let Ok(i) = self.state.worker_count.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |i| {
141-
if i < self.max_workers {
142-
Some(i + 1)
143-
} else {
144-
None
145-
}
146-
}) else {
140+
let Ok(i) = self
141+
.state
142+
.worker_count
143+
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |i| {
144+
if i < self.max_workers {
145+
Some(i + 1)
146+
} else {
147+
None
148+
}
149+
})
150+
else {
147151
return Ok(false);
148152
};
149153
self.state.idle_worker_count.fetch_add(1, Ordering::SeqCst);

mountpoint-s3/src/inode.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ impl Superblock {
166166
return;
167167
};
168168
let mut parent_state = parent.inner.sync.write().unwrap();
169-
let InodeKindData::Directory { children, writing_children, .. } = &mut parent_state.kind_data else {
169+
let InodeKindData::Directory {
170+
children,
171+
writing_children,
172+
..
173+
} = &mut parent_state.kind_data
174+
else {
170175
unreachable!("parent is always a directory");
171176
};
172177
if let Some(child) = children.get(inode.name()) {
@@ -745,7 +750,12 @@ impl SuperblockInner {
745750
match (remote, inode) {
746751
(None, None) => Err(InodeError::FileDoesNotExist),
747752
(None, Some(existing_inode)) => {
748-
let InodeKindData::Directory { children, writing_children, .. } = &mut parent_state.kind_data else {
753+
let InodeKindData::Directory {
754+
children,
755+
writing_children,
756+
..
757+
} = &mut parent_state.kind_data
758+
else {
749759
unreachable!("we know parent is a directory");
750760
};
751761
if writing_children.contains(&existing_inode.ino()) {

0 commit comments

Comments
 (0)