Skip to content

Commit 627282e

Browse files
committed
clippy
1 parent 509805f commit 627282e

File tree

11 files changed

+19
-26
lines changed

11 files changed

+19
-26
lines changed

rc-zip-cli/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ where
2222
{
2323
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2424
if let Some(x) = self.0.as_ref() {
25-
write!(f, "{}", x)
25+
write!(f, "{x}")
2626
} else {
2727
write!(f, "∅")
2828
}
@@ -35,7 +35,7 @@ where
3535
{
3636
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3737
if let Some(x) = self.0.as_ref() {
38-
write!(f, "{:?}", x)
38+
write!(f, "{x:?}")
3939
} else {
4040
write!(f, "∅")
4141
}
@@ -111,7 +111,7 @@ fn do_main(cli: Cli) -> Result<(), Box<dyn std::error::Error>> {
111111
}
112112
}
113113
}
114-
println!("Versions: {:?}", reader_versions);
114+
println!("Versions: {reader_versions:?}");
115115
println!("Encoding: {}, Methods: {:?}", archive.encoding(), methods);
116116
println!(
117117
"{} ({:.2}% compression) ({} files, {} dirs, {} symlinks)",
@@ -160,7 +160,7 @@ fn do_main(cli: Cli) -> Result<(), Box<dyn std::error::Error>> {
160160
if let EntryKind::Symlink = entry.kind() {
161161
let mut target = String::new();
162162
entry.reader().read_to_string(&mut target).unwrap();
163-
print!("\t{target}", target = target);
163+
print!("\t{target}");
164164
}
165165

166166
print!("\t{:?}", entry.method);

rc-zip-sync/src/entry_reader.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ where
5959
// progress was made, keep reading
6060
continue;
6161
} else {
62-
return Err(io::Error::new(
63-
io::ErrorKind::Other,
64-
"entry reader: no progress",
65-
));
62+
return Err(io::Error::other("entry reader: no progress"));
6663
}
6764
}
6865
FsmResult::Done(_) => {

rc-zip-sync/src/local_header_reader.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ where
7575
// progress was made, keep reading
7676
continue;
7777
} else {
78-
return Err(io::Error::new(
79-
io::ErrorKind::Other,
80-
"entry reader: no progress",
81-
));
78+
return Err(io::Error::other("entry reader: no progress"));
8279
}
8380
}
8481
FsmResult::Done((_, local_file_header, aex_data)) => {

rc-zip-tokio/src/entry_reader.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,7 @@ where
8181
// progress was made, keep reading
8282
continue;
8383
} else {
84-
return Err(io::Error::new(
85-
io::ErrorKind::Other,
86-
"entry reader: no progress",
87-
))
88-
.into();
84+
return Err(io::Error::other("entry reader: no progress")).into();
8985
}
9086
}
9187
FsmResult::Done(_) => {

rc-zip-tokio/src/read_zip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl AsyncRead for AsyncRandomAccessFileCursor {
350350
let core = futures_util::ready!(fut
351351
.as_mut()
352352
.poll(cx)
353-
.map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))??);
353+
.map_err(|e| io::Error::other(e.to_string()))??);
354354
let is_eof = core.inner_buf_len == 0;
355355
self.state = ARAFCState::Idle(core);
356356

rc-zip-tokio/tests/integration_tests.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ impl<R> HasCursor for OneByteReadWrapper<R>
122122
where
123123
R: HasCursor,
124124
{
125-
type Cursor<'a> = OneByteReadWrapper<<R as HasCursor>::Cursor<'a>> where R: 'a;
125+
type Cursor<'a>
126+
= OneByteReadWrapper<<R as HasCursor>::Cursor<'a>>
127+
where
128+
R: 'a;
126129

127130
fn cursor_at(&self, offset: u64) -> Self::Cursor<'_> {
128131
OneByteReadWrapper(self.0.cursor_at(offset))

rc-zip/src/corpus/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ pub fn check_case(case: &Case, archive: Result<&Archive, &Error>) {
276276
Err(e) => e,
277277
Ok(_) => panic!("should have failed"),
278278
};
279-
let expected = format!("{:#?}", expected);
280-
let actual = format!("{:#?}", actual);
279+
let expected = format!("{expected:#?}");
280+
let actual = format!("{actual:#?}");
281281
assert_eq!(expected, actual);
282282
return;
283283
}

rc-zip/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl From<Error> for std::io::Error {
169169
fn from(e: Error) -> Self {
170170
match e {
171171
Error::IO(e) => e,
172-
e => std::io::Error::new(std::io::ErrorKind::Other, e),
172+
e => std::io::Error::other(e),
173173
}
174174
}
175175
}

rc-zip/src/parse/date_time.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub struct MsdosTimestamp {
2424
impl fmt::Debug for MsdosTimestamp {
2525
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2626
match self.to_datetime() {
27-
Some(dt) => write!(f, "MsdosTimestamp({})", dt),
27+
Some(dt) => write!(f, "MsdosTimestamp({dt})"),
2828
None => write!(f, "MsdosTimestamp(?)"),
2929
}
3030
}
@@ -78,7 +78,7 @@ pub struct NtfsTimestamp {
7878
impl fmt::Debug for NtfsTimestamp {
7979
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
8080
match self.to_datetime() {
81-
Some(dt) => write!(f, "NtfsTimestamp({})", dt),
81+
Some(dt) => write!(f, "NtfsTimestamp({dt})"),
8282
None => write!(f, "NtfsTimestamp(?)"),
8383
}
8484
}

rc-zip/src/parse/mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl fmt::Display for Mode {
9999
let rwx = "rwxrwxrwx";
100100
for (i, c) in rwx.char_indices() {
101101
if self.has(Mode(1 << (9 - 1 - i))) {
102-
write!(f, "{}", c)?;
102+
write!(f, "{c}")?;
103103
} else {
104104
write!(f, "-")?;
105105
}

0 commit comments

Comments
 (0)