ci(fuzz): Fix inaccuracies in cargo fuzz fmt
This commit is contained in:
parent
a0845c781d
commit
2333a847f7
2 changed files with 19 additions and 8 deletions
|
@ -45,10 +45,11 @@ impl <'k> Debug for FileOperation<'k> {
|
|||
match &self.basic {
|
||||
BasicFileOperation::WriteNormalFile {contents, options} => {
|
||||
f.write_fmt(format_args!("let options = {:?};\n\
|
||||
writer.start_file_from_path({:?}, options)?;\n\
|
||||
writer.write_all(&({:?}[..] as [u8]))?;\n\
|
||||
drop(options);\n",
|
||||
options, self.path, contents))
|
||||
writer.start_file_from_path({:?}, options)?;\n", options, self.path))?;
|
||||
for content_slice in contents {
|
||||
f.write_fmt("writer.write_all(&({ : ? }[..] as [u8]))?;\n", content_slice)?;
|
||||
}
|
||||
f.write_str("drop(options);\n")
|
||||
},
|
||||
BasicFileOperation::WriteDirectory(options) => {
|
||||
f.write_fmt(format_args!("let options = {:?};\n\
|
||||
|
@ -73,8 +74,7 @@ impl <'k> Debug for FileOperation<'k> {
|
|||
{{\n\
|
||||
{:?}
|
||||
}}\n\
|
||||
writer.shallow_copy_file_from_path(path, {:?})?;\n\
|
||||
drop(path);\n", base.path, base, self.path))
|
||||
writer.deep_copy_file_from_path(path, {:?})?;\n", base.path, base, self.path))
|
||||
},
|
||||
BasicFileOperation::MergeWithOtherFile {operations} => {
|
||||
f.write_str("let sub_writer = {\n\
|
||||
|
@ -89,7 +89,7 @@ impl <'k> Debug for FileOperation<'k> {
|
|||
}).collect::<Result<(), _>>()?;
|
||||
f.write_str("writer\n\
|
||||
};\n\
|
||||
writer = sub_writer;\n")
|
||||
writer.merge_archive(sub_writer.finish_into_readable()?)?;\n")
|
||||
},
|
||||
}?;
|
||||
match &self.reopen {
|
||||
|
|
13
src/types.rs
13
src/types.rs
|
@ -3,6 +3,7 @@ use crate::cp437::FromCp437;
|
|||
use crate::write::{FileOptionExtension, FileOptions};
|
||||
use path::{Component, Path, PathBuf};
|
||||
use std::fmt;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::mem;
|
||||
use std::path;
|
||||
use std::sync::{Arc, OnceLock};
|
||||
|
@ -77,7 +78,7 @@ impl From<System> for u8 {
|
|||
///
|
||||
/// Modern zip files store more precise timestamps; see [`crate::extra_fields::ExtendedTimestamp`]
|
||||
/// for details.
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
#[derive(Clone, Copy, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
pub struct DateTime {
|
||||
year: u16,
|
||||
month: u8,
|
||||
|
@ -87,6 +88,16 @@ pub struct DateTime {
|
|||
second: u8,
|
||||
}
|
||||
|
||||
impl Debug for DateTime {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
if *self == Self::default() {
|
||||
return f.write_str("DateTime::default()");
|
||||
}
|
||||
f.write_fmt(format_args!("DateTime::from_date_and_time({}, {}, {}, {}, {}, {})?",
|
||||
self.year, self.month, self.day, self.hour, self.minute, self.second))
|
||||
}
|
||||
}
|
||||
|
||||
impl DateTime {
|
||||
/// Returns the current time if possible, otherwise the default of 1980-01-01.
|
||||
#[cfg(feature = "time")]
|
||||
|
|
Loading…
Add table
Reference in a new issue