Skip to content

Commit

Permalink
Derive the default for enums with #[derive(Default)]/#[default] (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nickelc authored Mar 10, 2023
1 parent b2f4704 commit 1642135
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
24 changes: 4 additions & 20 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,36 +1117,20 @@ pub struct ComputedValues {
pub true_color: bool,
}

#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub enum Width {
Fixed(usize),
#[default]
Variable,
}

impl Default for Width {
fn default() -> Self {
Width::Variable
}
}

#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub enum InspectRawLines {
True,
#[default]
False,
}

impl Default for InspectRawLines {
fn default() -> Self {
InspectRawLines::False
}
}

impl Default for PagingMode {
fn default() -> Self {
PagingMode::Never
}
}

impl Opt {
pub fn from_args_and_git_config(
env: DeltaEnv,
Expand Down
3 changes: 2 additions & 1 deletion src/utils/bat/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ use crate::env::DeltaEnv;
use crate::fatal;
use crate::features::navigate;

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[allow(dead_code)]
pub enum PagingMode {
Always,
QuitIfOneScreen,
#[default]
Never,
}
use crate::errors::*;
Expand Down

0 comments on commit 1642135

Please # to comment.