Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use field init shorthand #256

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .rustfmt.toml
@@ -0,0 +1 @@
use_field_init_shorthand = true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be deleted? I don't think this needs to be long-lived in this crate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It absolutely can be deleted. However this config would prevent ever having to have this conversation again...

15 changes: 6 additions & 9 deletions src/archive.rs
Expand Up @@ -72,7 +72,7 @@ impl<R: Read> Archive<R> {
pub fn entries(&mut self) -> io::Result<Entries<R>> {
let me: &mut Archive<dyn Read> = self;
me._entries().map(|fields| Entries {
fields: fields,
fields,
_ignored: marker::PhantomData,
})
}
Expand Down Expand Up @@ -213,10 +213,7 @@ impl<'a, R: Read> Entries<'a, R> {
/// or long link archive members. Raw iteration is disabled by default.
pub fn raw(self, raw: bool) -> Entries<'a, R> {
Entries {
fields: EntriesFields {
raw: raw,
..self.fields
},
fields: EntriesFields { raw, ..self.fields },
_ignored: marker::PhantomData,
}
}
Expand Down Expand Up @@ -282,11 +279,11 @@ impl<'a> EntriesFields<'a> {
}
}
let ret = EntryFields {
size: size,
header_pos: header_pos,
file_pos: file_pos,
size,
header_pos,
file_pos,
data: vec![EntryIo::Data((&self.archive.inner).take(size))],
header: header,
header,
long_pathname: None,
long_linkname: None,
pax_extensions: None,
Expand Down