Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions asyncgit/src/sync/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,18 @@ use super::{repository::repo, RepoPath};
// see https://git-scm.com/docs/git-config#Documentation/git-config.txt-statusshowUntrackedFiles
/// represents the `status.showUntrackedFiles` git config state
#[derive(
Hash, Copy, Clone, PartialEq, Eq, Serialize, Deserialize,
Hash, Copy, Clone, Default, PartialEq, Eq, Serialize, Deserialize,
)]
pub enum ShowUntrackedFilesConfig {
///
#[default]
No,
///
Normal,
///
All,
}

impl Default for ShowUntrackedFilesConfig {
fn default() -> Self {
Self::No
}
}

impl ShowUntrackedFilesConfig {
///
pub const fn include_none(self) -> bool {
Expand Down Expand Up @@ -68,21 +63,16 @@ pub fn untracked_files_config_repo(

// see https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushdefault
/// represents `push.default` git config
#[derive(PartialEq, Eq)]
#[derive(PartialEq, Default, Eq)]
pub enum PushDefaultStrategyConfig {
Nothing,
Current,
Upstream,
#[default]
Simple,
Matching,
}

impl Default for PushDefaultStrategyConfig {
fn default() -> Self {
Self::Simple
}
}

impl<'a> TryFrom<&'a str> for PushDefaultStrategyConfig {
type Error = crate::Error;
fn try_from(
Expand Down
9 changes: 2 additions & 7 deletions asyncgit/src/sync/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ use serde::{Deserialize, Serialize};
use std::{cell::RefCell, fs, path::Path, rc::Rc};

/// type of diff of a single line
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
#[derive(Copy, Clone, Default, PartialEq, Eq, Hash, Debug)]
pub enum DiffLineType {
/// just surrounding line, no change
#[default]
None,
/// header of the hunk
Header,
Expand All @@ -47,12 +48,6 @@ impl From<git2::DiffLineType> for DiffLineType {
}
}

impl Default for DiffLineType {
fn default() -> Self {
Self::None
}
}

///
#[derive(Default, Clone, Hash, Debug)]
pub struct DiffLine {
Expand Down
9 changes: 2 additions & 7 deletions asyncgit/src/sync/remotes/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,15 @@ impl AsyncProgress for ProgressNotification {
}

///
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub enum PushType {
///
#[default]
Branch,
///
Tag,
}

impl Default for PushType {
fn default() -> Self {
Self::Branch
}
}

#[cfg(test)]
pub fn push_branch(
repo_path: &RepoPath,
Expand Down
9 changes: 2 additions & 7 deletions asyncgit/src/sync/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,17 @@ pub struct StatusItem {
}

///
#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
#[derive(Copy, Clone, Default, Hash, PartialEq, Eq, Debug)]
pub enum StatusType {
///
#[default]
WorkingDir,
///
Stage,
///
Both,
}

impl Default for StatusType {
fn default() -> Self {
Self::WorkingDir
}
}

impl From<StatusType> for StatusShow {
fn from(s: StatusType) -> Self {
match s {
Expand Down
Loading