Skip to content

Commit

Permalink
Rust fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
vswarte committed Apr 14, 2024
1 parent 213d8a2 commit e5b91ce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use clap::{Parser, Subcommand, ValueEnum};
use fstools_dvdbnd::{DvdBnd, FileKeyProvider};

use crate::{
describe::{describe_bnd, describe_matbin, describe_entryfilelist},
describe::{describe_bnd, describe_entryfilelist, describe_matbin},
extract::extract,
};

Expand Down
24 changes: 18 additions & 6 deletions crates/formats/src/entryfilelist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ pub struct SectionIter<'a, TElement> {
}

impl<'a, TElement> SectionIter<'a, TElement> {
fn skip_to_end(&mut self) -> io::Result<()> {
fn skip_to_end(&mut self) -> io::Result<()> {
if self.entries_read != self.entry_count {
let remaining = (self.entry_count - self.entries_read) * std::mem::size_of::<TElement>();
let remaining =
(self.entry_count - self.entries_read) * std::mem::size_of::<TElement>();
std::io::copy(
&mut self.decoder.by_ref().take(remaining as u64),
&mut std::io::sink(),
Expand All @@ -140,7 +141,9 @@ impl<'a, TElement> SectionIter<'a, TElement> {
}

pub trait SectionElement: Sized {
fn read(reader: &mut impl Read) -> std::io::Result<Self> where Self: Sized;
fn read(reader: &mut impl Read) -> std::io::Result<Self>
where
Self: Sized;
}

impl<'a, TElement> Iterator for SectionIter<'a, TElement>
Expand Down Expand Up @@ -172,7 +175,10 @@ pub struct Unk1 {
}

impl SectionElement for Unk1 {
fn read(reader: &mut impl Read) -> std::io::Result<Self> where Self: Sized {
fn read(reader: &mut impl Read) -> std::io::Result<Self>
where
Self: Sized,
{
Ok(Unk1 {
step: reader.read_u16::<LE>()?,
index: reader.read_u16::<LE>()?,
Expand Down Expand Up @@ -200,7 +206,10 @@ impl<'a> SectionIter<'a, Unk1> {
pub struct Unk2(u64);

impl SectionElement for Unk2 {
fn read(reader: &mut impl Read) -> std::io::Result<Self> where Self: Sized {
fn read(reader: &mut impl Read) -> std::io::Result<Self>
where
Self: Sized,
{
Ok(Unk2(reader.read_u64::<LE>()?))
}
}
Expand All @@ -210,7 +219,10 @@ impl SectionElement for Unk2 {
pub struct UnkString(String);

impl SectionElement for UnkString {
fn read(reader: &mut impl Read) -> std::io::Result<Self> where Self: Sized {
fn read(reader: &mut impl Read) -> std::io::Result<Self>
where
Self: Sized,
{
let mut string = String::new();

loop {
Expand Down

0 comments on commit e5b91ce

Please sign in to comment.