mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 08:58:21 +00:00
Derive Default per clippy recommendation (#2712)
This commit is contained in:
parent
8bff603a72
commit
60912c0b47
4 changed files with 10 additions and 35 deletions
|
|
@ -8,10 +8,11 @@ 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,
|
||||
|
|
@ -19,12 +20,6 @@ pub enum ShowUntrackedFilesConfig {
|
|||
All,
|
||||
}
|
||||
|
||||
impl Default for ShowUntrackedFilesConfig {
|
||||
fn default() -> Self {
|
||||
Self::No
|
||||
}
|
||||
}
|
||||
|
||||
impl ShowUntrackedFilesConfig {
|
||||
///
|
||||
pub const fn include_none(self) -> bool {
|
||||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -104,9 +104,10 @@ pub struct StatusItem {
|
|||
}
|
||||
|
||||
///
|
||||
#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
|
||||
#[derive(Copy, Clone, Default, Hash, PartialEq, Eq, Debug)]
|
||||
pub enum StatusType {
|
||||
///
|
||||
#[default]
|
||||
WorkingDir,
|
||||
///
|
||||
Stage,
|
||||
|
|
@ -114,12 +115,6 @@ pub enum StatusType {
|
|||
Both,
|
||||
}
|
||||
|
||||
impl Default for StatusType {
|
||||
fn default() -> Self {
|
||||
Self::WorkingDir
|
||||
}
|
||||
}
|
||||
|
||||
impl From<StatusType> for StatusShow {
|
||||
fn from(s: StatusType) -> Self {
|
||||
match s {
|
||||
|
|
|
|||
Loading…
Reference in a new issue