Skip to content

Commit 69ba9d6

Browse files
mayastor-borstiagolobocastro
andcommitted
Merge #1896
1896: build: update nix and rust compiler r=tiagolobocastro a=tiagolobocastro Apply all the new clippy suggestions. Co-authored-by: Tiago Castro <[email protected]>
2 parents afdb8a2 + 5fb6448 commit 69ba9d6

File tree

31 files changed

+111
-134
lines changed

31 files changed

+111
-134
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

io-engine-tests/src/file_io.rs

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,12 @@ pub async fn test_write_to_file(
125125

126126
for k in 0..src_buf.len() {
127127
if src_buf[k] != dst_buf[k] {
128-
return Err(std::io::Error::new(
129-
std::io::ErrorKind::Other,
130-
format!(
131-
"Data validation failed at {}: written {:?}, read {:?}",
132-
pos + k as u64,
133-
src_buf[k],
134-
dst_buf[k]
135-
),
136-
));
128+
return Err(std::io::Error::other(format!(
129+
"Data validation failed at {}: written {:?}, read {:?}",
130+
pos + k as u64,
131+
src_buf[k],
132+
dst_buf[k]
133+
)));
137134
}
138135
}
139136

@@ -170,7 +167,7 @@ pub async fn compare_files(
170167
path_a: impl AsRef<Path>,
171168
path_b: impl AsRef<Path>,
172169
) -> std::io::Result<()> {
173-
use std::io::{Error, ErrorKind};
170+
use std::io::Error;
174171

175172
let name_a = path_a.as_ref();
176173
let name_b = path_b.as_ref();
@@ -201,10 +198,9 @@ pub async fn compare_files(
201198
let nb = fb.read(&mut buf_b).await?;
202199

203200
if na != nb {
204-
return Err(Error::new(
205-
ErrorKind::Other,
206-
format!("Size of file {name_a:?} != size of {name_b:?}"),
207-
));
201+
return Err(Error::other(format!(
202+
"Size of file {name_a:?} != size of {name_b:?}"
203+
)));
208204
}
209205

210206
if na == 0 {
@@ -213,16 +209,13 @@ pub async fn compare_files(
213209

214210
for i in 0..na {
215211
if buf_a[i] != buf_b[i] {
216-
return Err(Error::new(
217-
ErrorKind::Other,
218-
format!(
219-
"Miscompare at {pos}: {na:?} {va:#02x} != {nb:?} {vb:#02x}",
220-
na = name_a,
221-
va = buf_a[i],
222-
nb = name_b,
223-
vb = buf_b[i],
224-
),
225-
));
212+
return Err(Error::other(format!(
213+
"Miscompare at {pos}: {na:?} {va:#02x} != {nb:?} {vb:#02x}",
214+
na = name_a,
215+
va = buf_a[i],
216+
nb = name_b,
217+
vb = buf_b[i],
218+
)));
226219
}
227220
pos += 1;
228221
}

io-engine-tests/src/fio.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,10 @@ pub async fn spawn_fio_task(fio: &Fio) -> std::io::Result<()> {
352352
if fio.exit == 0 {
353353
Ok(())
354354
} else {
355-
Err(std::io::Error::new(
356-
std::io::ErrorKind::Other,
357-
format!(
358-
"SPDK FIO error: {exit} {err_msg}",
359-
exit = fio.exit,
360-
err_msg = fio.err_messages.join("\n")
361-
),
362-
))
355+
Err(std::io::Error::other(format!(
356+
"SPDK FIO error: {exit} {err_msg}",
357+
exit = fio.exit,
358+
err_msg = fio.err_messages.join("\n")
359+
)))
363360
}
364361
}

io-engine-tests/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ pub fn setup_rdma_rxe_device() -> String {
588588
.get(1)
589589
.expect("interface not found")
590590
.as_str();
591-
println!("Using interface {} to create rdma rxe device", iface);
591+
println!("Using interface {iface} to create rdma rxe device");
592592

593593
// now create the software rdma device.
594594
let _ = run_command_args(

io-engine/src/bdev/aio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl TryFrom<&Url> for Aio {
5353

5454
let path_is_blockdev = std::fs::metadata(url.path())
5555
.ok()
56-
.map_or(false, |meta| meta.file_type().is_block_device());
56+
.is_some_and(|meta| meta.file_type().is_block_device());
5757

5858
let mut parameters: HashMap<String, String> = url.query_pairs().into_owned().collect();
5959

io-engine/src/bdev/ftl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl TryFrom<&Url> for Ftl {
124124
.decode_utf8()
125125
.map_err(|e| BdevError::InvalidUri {
126126
uri: uri.to_string(),
127-
message: format!("Could not percent decode bbdev_uri sub-uri - {}", e),
127+
message: format!("Could not percent decode bbdev_uri sub-uri - {e}"),
128128
})?
129129
.to_string();
130130

@@ -137,7 +137,7 @@ impl TryFrom<&Url> for Ftl {
137137
.decode_utf8()
138138
.map_err(|e| BdevError::InvalidUri {
139139
uri: uri.to_string(),
140-
message: format!("Could not percent decode cbdev_uri sub-uri - {}", e),
140+
message: format!("Could not percent decode cbdev_uri sub-uri - {e}"),
141141
})?
142142
.to_string();
143143

io-engine/src/bdev/nexus/nexus_bdev_children.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ impl<'n> Nexus<'n> {
129129
let child_bdev = match device_lookup(&name) {
130130
Some(child) => {
131131
if child.block_len() != self.block_len()
132-
|| self
133-
.min_num_blocks()
134-
.map_or(true, |n| n > child.num_blocks())
132+
|| self.min_num_blocks().is_none_or(|n| n > child.num_blocks())
135133
{
136134
if let Err(err) = device_destroy(uri).await {
137135
error!(

io-engine/src/bdev/nexus/nexus_persistence.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,7 @@ impl<'n> Nexus<'n> {
323323
return Err(Error::SaveStateFailed {
324324
source: StoreError::Txn {
325325
key: key.clone(),
326-
source: EtcdErr::IoError(std::io::Error::new(
327-
std::io::ErrorKind::Other,
326+
source: EtcdErr::IoError(std::io::Error::other(
328327
"Txn CompareOp failed",
329328
)),
330329
},

io-engine/src/bdev/uring.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl TryFrom<&Url> for Uring {
3838

3939
let path_is_blockdev = std::fs::metadata(url.path())
4040
.ok()
41-
.map_or(false, |meta| meta.file_type().is_block_device());
41+
.is_some_and(|meta| meta.file_type().is_block_device());
4242

4343
let mut parameters: HashMap<String, String> = url.query_pairs().into_owned().collect();
4444

io-engine/src/bin/io-engine-client/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ async fn main() {
5454
}
5555
};
5656
if let Err(error) = result {
57-
eprintln!("{}", error);
57+
eprintln!("{error}");
5858
use snafu::ErrorCompat;
5959
if let Some(bt) = ErrorCompat::backtrace(&error) {
60-
eprintln!("{:#?}", bt);
60+
eprintln!("{bt:#?}");
6161
}
6262
std::process::exit(1);
6363
}

0 commit comments

Comments
 (0)