Skip to content

Commit f9fc36b

Browse files
authored
Bump Rust to 1.75 and fix new Clippy lints (#1123)
1 parent 2d4bc11 commit f9fc36b

File tree

7 files changed

+29
-39
lines changed

7 files changed

+29
-39
lines changed

crudd/src/main.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,10 @@ async fn handle_signals(
544544
mut signals: Signals,
545545
early_shutdown: oneshot::Sender<()>,
546546
) {
547-
while let Some(signal) = signals.next().await {
548-
match signal {
549-
SIGUSR1 => {
550-
early_shutdown.send(()).unwrap();
551-
break;
552-
}
553-
_ => unreachable!(),
554-
}
547+
match signals.next().await {
548+
Some(SIGUSR1) => early_shutdown.send(()).unwrap(),
549+
Some(_) => unreachable!(),
550+
None => (), // signal sender is dropped
555551
}
556552
}
557553

crutest/src/cli.rs

+16-18
Original file line numberDiff line numberDiff line change
@@ -658,24 +658,22 @@ pub async fn start_cli_client(attach: SocketAddr) -> Result<()> {
658658
let tcp = sock.connect(attach);
659659
tokio::pin!(tcp);
660660

661-
let mut tcp: TcpStream = loop {
662-
tokio::select! {
663-
_ = &mut deadline => {
664-
println!("connect timeout");
665-
continue 'outer;
666-
}
667-
tcp = &mut tcp => {
668-
match tcp {
669-
Ok(tcp) => {
670-
println!("connected to {}", attach);
671-
break tcp;
672-
}
673-
Err(e) => {
674-
println!("connect to {0} failure: {1:?}",
675-
attach, e);
676-
tokio::time::sleep_until(deadline_secs(10.0)).await;
677-
continue 'outer;
678-
}
661+
let mut tcp: TcpStream = tokio::select! {
662+
_ = &mut deadline => {
663+
println!("connect timeout");
664+
continue 'outer;
665+
}
666+
tcp = &mut tcp => {
667+
match tcp {
668+
Ok(tcp) => {
669+
println!("connected to {}", attach);
670+
tcp
671+
}
672+
Err(e) => {
673+
println!("connect to {0} failure: {1:?}",
674+
attach, e);
675+
tokio::time::sleep_until(deadline_secs(10.0)).await;
676+
continue 'outer;
679677
}
680678
}
681679
}

downstairs/src/dump.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ async fn show_extent_block(
725725
println!();
726726

727727
print!("{} ", String::from_utf8(vec![b'-'; 6])?);
728-
for (_, _) in dvec.iter().enumerate() {
728+
for _ in &dvec {
729729
print!("{} ", String::from_utf8(vec![b'-'; 24])?);
730730
}
731731
if !only_show_differences {
@@ -784,7 +784,7 @@ async fn show_extent_block(
784784
println!();
785785

786786
print!("{} ", String::from_utf8(vec![b'-'; 6])?);
787-
for (_, _) in dvec.iter().enumerate() {
787+
for _ in &dvec {
788788
print!("{} ", String::from_utf8(vec![b'-'; 32])?);
789789
}
790790
if !only_show_differences {
@@ -848,7 +848,7 @@ async fn show_extent_block(
848848
println!();
849849

850850
print!("{} ", String::from_utf8(vec![b'-'; 6])?);
851-
for (_, _) in dvec.iter().enumerate() {
851+
for _ in &dvec {
852852
print!("{} ", String::from_utf8(vec![b'-'; 16])?);
853853
}
854854
if !only_show_differences {

pantry/src/pantry.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,8 @@ impl PantryEntry {
307307
let volume_block_size =
308308
self.volume.check_data_size(size).await? as usize;
309309

310-
let mut buffer = crucible::Buffer::new(
311-
size / volume_block_size as usize,
312-
volume_block_size,
313-
);
310+
let mut buffer =
311+
crucible::Buffer::new(size / volume_block_size, volume_block_size);
314312

315313
self.volume
316314
.read_from_byte_offset(offset, &mut buffer)

protocol/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl ReadResponse {
150150
}
151151

152152
pub fn first_hash(&self) -> Option<u64> {
153-
self.block_contexts.get(0).map(|ctx| ctx.hash)
153+
self.block_contexts.first().map(|ctx| ctx.hash)
154154
}
155155

156156
pub fn encryption_contexts(&self) -> Vec<Option<&EncryptionContext>> {

rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.73"
2+
channel = "1.75"
33
profile = "default"

upstairs/src/test.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,10 @@ pub(crate) mod up_test {
116116
assert_eq!(span.buffer()[i], 0);
117117
}
118118

119-
let mut data = vec![0u8; 64];
119+
let mut data = [0u8; 64];
120120
span.read_from_blocks_into_buffer(&mut data[..]);
121121

122-
for i in 0..64 {
123-
assert_eq!(data[i], 1);
124-
}
122+
assert_eq!(data, [1; 64]);
125123
}
126124

127125
/*

0 commit comments

Comments
 (0)