Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@ jobs:
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install Rust specified toolchain
run: rustup show
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
Expand Down
8 changes: 4 additions & 4 deletions rc-zip-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ where
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(x) = self.0.as_ref() {
write!(f, "{}", x)
write!(f, "{x}")
} else {
write!(f, "∅")
}
Expand All @@ -35,7 +35,7 @@ where
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(x) = self.0.as_ref() {
write!(f, "{:?}", x)
write!(f, "{x:?}")
} else {
write!(f, "∅")
}
Expand Down Expand Up @@ -111,7 +111,7 @@ fn do_main(cli: Cli) -> Result<(), Box<dyn std::error::Error>> {
}
}
}
println!("Versions: {:?}", reader_versions);
println!("Versions: {reader_versions:?}");
println!("Encoding: {}, Methods: {:?}", archive.encoding(), methods);
println!(
"{} ({:.2}% compression) ({} files, {} dirs, {} symlinks)",
Expand Down Expand Up @@ -160,7 +160,7 @@ fn do_main(cli: Cli) -> Result<(), Box<dyn std::error::Error>> {
if let EntryKind::Symlink = entry.kind() {
let mut target = String::new();
entry.reader().read_to_string(&mut target).unwrap();
print!("\t{target}", target = target);
print!("\t{target}");
}

print!("\t{:?}", entry.method);
Expand Down
5 changes: 1 addition & 4 deletions rc-zip-sync/src/entry_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ where
// progress was made, keep reading
continue;
} else {
return Err(io::Error::new(
io::ErrorKind::Other,
"entry reader: no progress",
));
return Err(io::Error::other("entry reader: no progress"));
}
}
FsmResult::Done(_) => {
Expand Down
5 changes: 1 addition & 4 deletions rc-zip-sync/src/local_header_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ where
// progress was made, keep reading
continue;
} else {
return Err(io::Error::new(
io::ErrorKind::Other,
"entry reader: no progress",
));
return Err(io::Error::other("entry reader: no progress"));
}
}
FsmResult::Done((_, local_file_header, aex_data)) => {
Expand Down
6 changes: 1 addition & 5 deletions rc-zip-tokio/src/entry_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ where
// progress was made, keep reading
continue;
} else {
return Err(io::Error::new(
io::ErrorKind::Other,
"entry reader: no progress",
))
.into();
return Err(io::Error::other("entry reader: no progress")).into();
}
}
FsmResult::Done(_) => {
Expand Down
2 changes: 1 addition & 1 deletion rc-zip-tokio/src/read_zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ impl AsyncRead for AsyncRandomAccessFileCursor {
let core = futures_util::ready!(fut
.as_mut()
.poll(cx)
.map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))??);
.map_err(|e| io::Error::other(e.to_string()))??);
let is_eof = core.inner_buf_len == 0;
self.state = ARAFCState::Idle(core);

Expand Down
5 changes: 4 additions & 1 deletion rc-zip-tokio/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ impl<R> HasCursor for OneByteReadWrapper<R>
where
R: HasCursor,
{
type Cursor<'a> = OneByteReadWrapper<<R as HasCursor>::Cursor<'a>> where R: 'a;
type Cursor<'a>
= OneByteReadWrapper<<R as HasCursor>::Cursor<'a>>
where
R: 'a;

fn cursor_at(&self, offset: u64) -> Self::Cursor<'_> {
OneByteReadWrapper(self.0.cursor_at(offset))
Expand Down
4 changes: 2 additions & 2 deletions rc-zip/src/corpus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ pub fn check_case(case: &Case, archive: Result<&Archive, &Error>) {
Err(e) => e,
Ok(_) => panic!("should have failed"),
};
let expected = format!("{:#?}", expected);
let actual = format!("{:#?}", actual);
let expected = format!("{expected:#?}");
let actual = format!("{actual:#?}");
assert_eq!(expected, actual);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion rc-zip/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl From<Error> for std::io::Error {
fn from(e: Error) -> Self {
match e {
Error::IO(e) => e,
e => std::io::Error::new(std::io::ErrorKind::Other, e),
e => std::io::Error::other(e),
}
}
}
4 changes: 2 additions & 2 deletions rc-zip/src/parse/date_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct MsdosTimestamp {
impl fmt::Debug for MsdosTimestamp {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.to_datetime() {
Some(dt) => write!(f, "MsdosTimestamp({})", dt),
Some(dt) => write!(f, "MsdosTimestamp({dt})"),
None => write!(f, "MsdosTimestamp(?)"),
}
}
Expand Down Expand Up @@ -78,7 +78,7 @@ pub struct NtfsTimestamp {
impl fmt::Debug for NtfsTimestamp {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.to_datetime() {
Some(dt) => write!(f, "NtfsTimestamp({})", dt),
Some(dt) => write!(f, "NtfsTimestamp({dt})"),
None => write!(f, "NtfsTimestamp(?)"),
}
}
Expand Down
2 changes: 1 addition & 1 deletion rc-zip/src/parse/mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl fmt::Display for Mode {
let rwx = "rwxrwxrwx";
for (i, c) in rwx.char_indices() {
if self.has(Mode(1 << (9 - 1 - i))) {
write!(f, "{}", c)?;
write!(f, "{c}")?;
} else {
write!(f, "-")?;
}
Expand Down
15 changes: 15 additions & 0 deletions testdata/readme.streamingzip
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
To create a file without a name using ZIP streaming:

$ echo "bla" | zip -r streaming.zip -
adding: - (stored 0%)

$ file streaming.zip
streaming.zip: Zip archive data, at least v4.5 to extract, compression method=store

$ unzip -l streaming.zip
Archive: streaming.zip
Length Date Time Name
--------- ---------- ----- ----
4 06-27-2025 15:25 -
--------- -------
4 1 file
Binary file added testdata/streaming.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion ziplinter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ struct Error {
impl<T: std::fmt::Debug> From<T> for Error {
fn from(error: T) -> Self {
Error {
error: format!("{:?}", error),
error: format!("{error:?}"),
}
}
}
Expand Down
142 changes: 142 additions & 0 deletions ziplinter/src/snapshots/ziplinter__test__streaming.zip.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
---
source: ziplinter/src/lib.rs
expression: result
---
{
"comment": "",
"contents": [
{
"central": {
"comment": "",
"compressed_size": 4,
"crc32": 1838506280,
"creator_version": {
"host_system": "Unix",
"version": 30
},
"disk_nbr_start": 0,
"external_attrs": 293601280,
"extra": [],
"flags": 0,
"header_offset": 0,
"internal_attrs": 1,
"method": "Store",
"mode": 33554816,
"modified": "2025-06-27T15:25:46Z",
"name": "-",
"reader_version": {
"host_system": "MsDos",
"version": 45
},
"uncompressed_size": 4
},
"local": {
"accessed": null,
"compressed_size": 4,
"crc32": 1838506280,
"created": null,
"extra": [
1,
0,
16,
0,
4,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0
],
"flags": 0,
"gid": null,
"header_offset": 0,
"method": "Store",
"method_specific": "None",
"mode": 0,
"modified": "2025-06-27T15:25:46Z",
"name": "-",
"reader_version": {
"host_system": "MsDos",
"version": 45
},
"uid": null,
"uncompressed_size": 4
}
}
],
"encoding": "Utf8",
"eocd": {
"dir": {
"inner": {
"dir_disk_nbr": 0,
"dir_records_this_disk": 1,
"directory_offset": 55,
"directory_records": 1,
"directory_size": 47,
"disk_nbr": 0
},
"offset": 178
},
"dir64": {
"inner": {
"creator_version": 798,
"dir_disk_nbr": 0,
"dir_records_this_disk": 1,
"directory_offset": 55,
"directory_records": 1,
"directory_size": 47,
"disk_nbr": 0,
"reader_version": 45,
"record_size": 44
},
"offset": 102
},
"global_offset": 0
},
"parsed_ranges": [
{
"contains": "end of central directory record",
"end": 200,
"start": 178
},
{
"contains": "zip64 end of central directory locator",
"end": 178,
"start": 158
},
{
"contains": "zip64 end of central directory record",
"end": 158,
"start": 102
},
{
"contains": "central directory header",
"end": 102,
"filename": "-",
"start": 55
},
{
"contains": "local file header",
"end": 51,
"filename": "-",
"start": 0
},
{
"contains": "file data",
"end": 55,
"filename": "-",
"start": 51
}
],
"size": 200
}