implement Eq where possible

This commit is contained in:
Lynne Megido 2022-09-04 12:55:30 +10:00
parent 74098ed281
commit 866a8d41d5
Signed by: lynnesbian
GPG Key ID: F0A184B5213D9F90
2 changed files with 6 additions and 6 deletions

View File

@ -55,7 +55,7 @@ macro_rules! writablesln {
}; };
} }
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub enum Writable<'a> { pub enum Writable<'a> {
String(&'a str), String(&'a str),
Path(&'a Path), Path(&'a Path),
@ -111,7 +111,7 @@ pub fn smart_write<W: Write>(f: &mut W, writeables: &[Writable]) -> io::Result<(
// f.write_all(&*path.as_os_str().encode_wide().collect::<Vec<u16>>())?; // f.write_all(&*path.as_os_str().encode_wide().collect::<Vec<u16>>())?;
write!(f, "{}", path.as_os_str().to_string_lossy())?; write!(f, "{}", path.as_os_str().to_string_lossy())?;
} else { } else {
f.write_all(&*path.as_os_str().as_bytes())?; f.write_all(path.as_os_str().as_bytes())?;
} }
} }
write!(f, "'")?; write!(f, "'")?;

View File

@ -22,7 +22,7 @@ cfg_if! {
} }
} }
#[derive(ArgEnum, PartialEq, Debug, Copy, Clone)] #[derive(ArgEnum, Eq, PartialEq, Debug, Copy, Clone)]
/// The format to use when running fif without the `--fix` flag. Specified at runtime with the `-o`/`--output-format` /// The format to use when running fif without the `--fix` flag. Specified at runtime with the `-o`/`--output-format`
/// flag. /// flag.
pub enum OutputFormat { pub enum OutputFormat {
@ -39,7 +39,7 @@ pub enum OutputFormat {
Json, Json,
} }
#[derive(ArgEnum, PartialEq, Debug, Copy, Clone)] #[derive(ArgEnum, Eq, PartialEq, Debug, Copy, Clone)]
/// Specifies under what conditions the user should be prompted when running fif in `--fix` mode. Defaults to `Error`. /// Specifies under what conditions the user should be prompted when running fif in `--fix` mode. Defaults to `Error`.
/// Specified at runtime with the `-p`/`--prompt` flag. /// Specified at runtime with the `-p`/`--prompt` flag.
pub enum Prompt { pub enum Prompt {
@ -195,7 +195,7 @@ fn validate_exts(exts: &str) -> Result<(), String> {
} }
/// Further options relating to scanning. /// Further options relating to scanning.
#[derive(PartialEq, Debug, Copy, Clone)] #[derive(Eq, PartialEq, Debug, Copy, Clone)]
#[allow(clippy::struct_excessive_bools)] #[allow(clippy::struct_excessive_bools)]
pub struct ScanOpts { pub struct ScanOpts {
/// Whether hidden files and directories should be scanned. /// Whether hidden files and directories should be scanned.
@ -298,7 +298,7 @@ impl Parameters {
} }
/// Sets of extensions for use with [Parameter](crate::parameters::Parameters)'s `-E` flag. /// Sets of extensions for use with [Parameter](crate::parameters::Parameters)'s `-E` flag.
#[derive(ArgEnum, PartialEq, Debug, Copy, Clone)] #[derive(ArgEnum, Eq, PartialEq, Debug, Copy, Clone)]
pub enum ExtensionSet { pub enum ExtensionSet {
/// Extensions used for image file formats, such as `png`, `jpeg`, `webp`, etc. /// Extensions used for image file formats, such as `png`, `jpeg`, `webp`, etc.
Images, Images,