mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-21 19:45:11 +00:00
Safely derive Eq
whenever we derive PartialEq
This commit is contained in:
parent
89bcc00e32
commit
cd715a6e00
@ -176,7 +176,7 @@ impl<'dir, 'ig> Iterator for Files<'dir, 'ig> {
|
||||
/// Usually files in Unix use a leading dot to be hidden or visible, but two
|
||||
/// entries in particular are “extra-hidden”: `.` and `..`, which only become
|
||||
/// visible after an extra `-a` option.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum DotFilter {
|
||||
|
||||
/// Shows files, dotfiles, and `.` and `..`.
|
||||
|
@ -19,7 +19,7 @@
|
||||
/// into them and print out their contents. The recurse mode does this by
|
||||
/// having extra output blocks at the end, while the tree mode will show
|
||||
/// directories inline, with their contents immediately underneath.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum DirAction {
|
||||
|
||||
/// This directory should be listed along with the regular files, instead
|
||||
@ -58,7 +58,7 @@ impl DirAction {
|
||||
|
||||
|
||||
/// The options that determine how to recurse into a directory.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub struct RecurseOptions {
|
||||
|
||||
/// Whether recursion should be done as a tree or as multiple individual
|
||||
|
@ -210,7 +210,7 @@ pub struct Time {
|
||||
/// A file’s status in a Git repository. Whether a file is in a repository or
|
||||
/// not is handled by the Git module, rather than having a “null” variant in
|
||||
/// this enum.
|
||||
#[derive(PartialEq, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Copy, Clone)]
|
||||
pub enum GitStatus {
|
||||
|
||||
/// This file hasn’t changed since the last commit.
|
||||
|
@ -23,7 +23,7 @@ use crate::fs::File;
|
||||
/// The filter also governs sorting the list. After being filtered, pairs of
|
||||
/// files are compared and sorted based on the result, with the sort field
|
||||
/// performing the comparison.
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||
pub struct FileFilter {
|
||||
|
||||
/// Whether directories should be listed first, and other types of file
|
||||
@ -113,7 +113,7 @@ impl FileFilter {
|
||||
|
||||
|
||||
/// User-supplied field to sort by.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum SortField {
|
||||
|
||||
/// Don’t apply any sorting. This is usually used as an optimisation in
|
||||
@ -194,7 +194,7 @@ pub enum SortField {
|
||||
/// lowercase letters because it takes the difference between the two cases
|
||||
/// into account? I gave up and just named these two variants after the
|
||||
/// effects they have.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum SortCase {
|
||||
|
||||
/// Sort files case-sensitively with uppercase first, with ‘A’ coming
|
||||
@ -271,7 +271,7 @@ impl SortField {
|
||||
/// The **ignore patterns** are a list of globs that are tested against
|
||||
/// each filename, and if any of them match, that file isn’t displayed.
|
||||
/// This lets a user hide, say, text files by ignoring `*.txt`.
|
||||
#[derive(PartialEq, Default, Debug, Clone)]
|
||||
#[derive(PartialEq, Eq, Default, Debug, Clone)]
|
||||
pub struct IgnorePatterns {
|
||||
patterns: Vec<glob::Pattern>,
|
||||
}
|
||||
@ -327,7 +327,7 @@ impl IgnorePatterns {
|
||||
|
||||
|
||||
/// Whether to ignore or display files that Git would ignore.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum GitIgnore {
|
||||
|
||||
/// Ignore files that Git would ignore.
|
||||
|
@ -11,7 +11,7 @@ use crate::output::icons::FileIcon;
|
||||
use crate::theme::FileColours;
|
||||
|
||||
|
||||
#[derive(Debug, Default, PartialEq)]
|
||||
#[derive(Debug, Default, PartialEq, Eq)]
|
||||
pub struct FileExtensions;
|
||||
|
||||
impl FileExtensions {
|
||||
|
@ -7,7 +7,7 @@ use crate::options::parser::{Arg, Flag, ParseError};
|
||||
|
||||
|
||||
/// Something wrong with the combination of options the user has picked.
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub enum OptionsError {
|
||||
|
||||
/// There was an error (from `getopts`) parsing the arguments.
|
||||
@ -44,7 +44,7 @@ pub enum OptionsError {
|
||||
}
|
||||
|
||||
/// The source of a string that failed to be parsed as a number.
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub enum NumberSource {
|
||||
|
||||
/// It came... from a command-line argument!
|
||||
@ -119,7 +119,7 @@ impl OptionsError {
|
||||
|
||||
|
||||
/// A list of legal choices for an argument-taking option.
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub struct Choices(pub &'static [&'static str]);
|
||||
|
||||
impl fmt::Display for Choices {
|
||||
|
@ -69,7 +69,7 @@ static EXTENDED_HELP: &str = " -@, --extended list each file's extended
|
||||
/// All the information needed to display the help text, which depends
|
||||
/// on which features are enabled and whether the user only wants to
|
||||
/// see one section’s help.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub struct HelpString;
|
||||
|
||||
impl HelpString {
|
||||
|
@ -216,7 +216,7 @@ pub mod test {
|
||||
use crate::options::parser::{Arg, MatchedFlags};
|
||||
use std::ffi::OsStr;
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub enum Strictnesses {
|
||||
Last,
|
||||
Complain,
|
||||
|
@ -52,7 +52,7 @@ pub type Values = &'static [&'static str];
|
||||
|
||||
/// A **flag** is either of the two argument types, because they have to
|
||||
/// be in the same array together.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum Flag {
|
||||
Short(ShortArg),
|
||||
Long(LongArg),
|
||||
@ -77,7 +77,7 @@ impl fmt::Display for Flag {
|
||||
}
|
||||
|
||||
/// Whether redundant arguments should be considered a problem.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum Strictness {
|
||||
|
||||
/// Throw an error when an argument doesn’t do anything, either because
|
||||
@ -91,7 +91,7 @@ pub enum Strictness {
|
||||
|
||||
/// Whether a flag takes a value. This is applicable to both long and short
|
||||
/// arguments.
|
||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
pub enum TakesValue {
|
||||
|
||||
/// This flag has to be followed by a value.
|
||||
@ -108,7 +108,7 @@ pub enum TakesValue {
|
||||
|
||||
|
||||
/// An **argument** can be matched by one of the user’s input strings.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub struct Arg {
|
||||
|
||||
/// The short argument that matches it, if any.
|
||||
@ -136,7 +136,7 @@ impl fmt::Display for Arg {
|
||||
|
||||
|
||||
/// Literally just several args.
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub struct Args(pub &'static [&'static Arg]);
|
||||
|
||||
impl Args {
|
||||
@ -340,7 +340,7 @@ impl Args {
|
||||
|
||||
|
||||
/// The **matches** are the result of parsing the user’s command-line strings.
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub struct Matches<'args> {
|
||||
|
||||
/// The flags that were parsed from the user’s input.
|
||||
@ -351,7 +351,7 @@ pub struct Matches<'args> {
|
||||
pub frees: Vec<&'args OsStr>,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub struct MatchedFlags<'args> {
|
||||
|
||||
/// The individual flags from the user’s input, in the order they were
|
||||
@ -462,7 +462,7 @@ impl<'a> MatchedFlags<'a> {
|
||||
|
||||
/// A problem with the user’s input that meant it couldn’t be parsed into a
|
||||
/// coherent list of arguments.
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub enum ParseError {
|
||||
|
||||
/// A flag that has to take a value was not given one.
|
||||
|
@ -8,7 +8,7 @@ use crate::options::flags;
|
||||
use crate::options::parser::MatchedFlags;
|
||||
|
||||
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub struct VersionString;
|
||||
// There were options here once, but there aren’t anymore!
|
||||
|
||||
|
@ -193,7 +193,7 @@ impl TextCellContents {
|
||||
///
|
||||
/// It has `From` impls that convert an input string or fixed with to values
|
||||
/// of this type, and will `Deref` to the contained `usize` value.
|
||||
#[derive(PartialEq, Debug, Clone, Copy, Default)]
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Copy, Default)]
|
||||
pub struct DisplayWidth(usize);
|
||||
|
||||
impl<'a> From<&'a str> for DisplayWidth {
|
||||
|
@ -91,7 +91,7 @@ use crate::theme::Theme;
|
||||
///
|
||||
/// Almost all the heavy lifting is done in a Table object, which handles the
|
||||
/// columns for each row.
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub struct Options {
|
||||
|
||||
/// Options specific to drawing a table.
|
||||
|
@ -54,7 +54,7 @@ enum LinkStyle {
|
||||
|
||||
|
||||
/// Whether to append file class characters to the file names.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum Classify {
|
||||
|
||||
/// Just display the file names, without any characters.
|
||||
@ -73,7 +73,7 @@ impl Default for Classify {
|
||||
|
||||
|
||||
/// Whether and how to show icons.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum ShowIcons {
|
||||
|
||||
/// Don’t show icons at all.
|
||||
|
@ -8,7 +8,7 @@ use crate::output::file_name::Options as FileStyle;
|
||||
use crate::theme::Theme;
|
||||
|
||||
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub struct Options {
|
||||
pub across: bool,
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ use crate::output::tree::{TreeParams, TreeDepth};
|
||||
use crate::theme::Theme;
|
||||
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub struct Options {
|
||||
pub grid: GridOptions,
|
||||
pub details: DetailsOptions,
|
||||
@ -39,7 +39,7 @@ impl Options {
|
||||
/// small directory of four files in four columns, the files just look spaced
|
||||
/// out and it’s harder to see what’s going on. So it can be enabled just for
|
||||
/// larger directory listings.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum RowThreshold {
|
||||
|
||||
/// Only use grid-details view if it would result in at least this many
|
||||
|
@ -26,7 +26,7 @@ pub struct View {
|
||||
|
||||
|
||||
/// The **mode** is the “type” of output.
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Mode {
|
||||
Grid(grid::Options),
|
||||
@ -37,7 +37,7 @@ pub enum Mode {
|
||||
|
||||
|
||||
/// The width of the terminal requested by the user.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum TerminalWidth {
|
||||
|
||||
/// The user requested this specific number of columns.
|
||||
|
@ -21,7 +21,7 @@ use crate::theme::Theme;
|
||||
|
||||
|
||||
/// Options for displaying a table.
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub struct Options {
|
||||
pub size_format: SizeFormat,
|
||||
pub time_format: TimeFormat,
|
||||
@ -31,7 +31,7 @@ pub struct Options {
|
||||
|
||||
/// Extra columns to display in the table.
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub struct Columns {
|
||||
|
||||
/// At least one of these timestamps will be shown.
|
||||
@ -201,7 +201,7 @@ impl Column {
|
||||
|
||||
/// Formatting options for file sizes.
|
||||
#[allow(clippy::pub_enum_variant_names)]
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum SizeFormat {
|
||||
|
||||
/// Format the file size using **decimal** prefixes, such as “kilo”,
|
||||
@ -217,7 +217,7 @@ pub enum SizeFormat {
|
||||
}
|
||||
|
||||
/// Formatting options for user and group.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum UserFormat {
|
||||
/// The UID / GID
|
||||
Numeric,
|
||||
@ -234,7 +234,7 @@ impl Default for SizeFormat {
|
||||
|
||||
/// The types of a file’s time fields. These three fields are standard
|
||||
/// across most (all?) operating systems.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum TimeType {
|
||||
|
||||
/// The file’s modified time (`st_mtime`).
|
||||
@ -269,7 +269,7 @@ impl TimeType {
|
||||
///
|
||||
/// There should always be at least one of these — there’s no way to disable
|
||||
/// the time columns entirely (yet).
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
pub struct TimeTypes {
|
||||
pub modified: bool,
|
||||
|
@ -25,7 +25,7 @@ use unicode_width::UnicodeWidthStr;
|
||||
///
|
||||
/// Currently exa does not support *custom* styles, where the user enters a
|
||||
/// format string in an environment variable or something. Just these four.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum TimeFormat {
|
||||
|
||||
/// The **default format** uses the user’s locale to print month names,
|
||||
|
@ -39,7 +39,7 @@
|
||||
//! each directory)
|
||||
|
||||
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum TreePart {
|
||||
|
||||
/// Rightmost column, *not* the last in the directory.
|
||||
|
@ -14,7 +14,7 @@ pub use self::lsc::LSColors;
|
||||
mod default_theme;
|
||||
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub struct Options {
|
||||
|
||||
pub use_colours: UseColours,
|
||||
@ -31,7 +31,7 @@ pub struct Options {
|
||||
/// Turning them on when output is going to, say, a pipe, would make programs
|
||||
/// such as `grep` or `more` not work properly. So the `Automatic` mode does
|
||||
/// this check and only displays colours when they can be truly appreciated.
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum UseColours {
|
||||
|
||||
/// Display them even when output isn’t going to a terminal.
|
||||
@ -44,13 +44,13 @@ pub enum UseColours {
|
||||
Never,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum ColourScale {
|
||||
Fixed,
|
||||
Gradient,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug, Default)]
|
||||
#[derive(PartialEq, Eq, Debug, Default)]
|
||||
pub struct Definitions {
|
||||
pub ls: Option<String>,
|
||||
pub exa: Option<String>,
|
||||
|
Loading…
Reference in New Issue
Block a user