diff --git a/lib/src/backend.rs b/lib/src/backend.rs index b01e40134..b401c7a85 100644 --- a/lib/src/backend.rs +++ b/lib/src/backend.rs @@ -172,7 +172,7 @@ pub struct ConflictPart { pub value: TreeValue, } -#[derive(Debug, PartialEq, Eq, Clone)] +#[derive(Default, Debug, PartialEq, Eq, Clone)] pub struct Conflict { // A conflict is represented by a list of positive and negative states that need to be applied. // In a simple 3-way merge of B and C with merge base A, the conflict will be { add: [B, C], @@ -182,15 +182,6 @@ pub struct Conflict { pub adds: Vec, } -impl Default for Conflict { - fn default() -> Self { - Conflict { - removes: Default::default(), - adds: Default::default(), - } - } -} - #[derive(Debug, Error, PartialEq, Eq)] pub enum BackendError { #[error("Object not found")] @@ -244,19 +235,11 @@ impl<'a> Iterator for TreeEntriesNonRecursiveIter<'a> { } } -#[derive(Debug, Clone)] +#[derive(Default, Debug, Clone)] pub struct Tree { entries: BTreeMap, } -impl Default for Tree { - fn default() -> Self { - Self { - entries: BTreeMap::new(), - } - } -} - impl Tree { pub fn is_empty(&self) -> bool { self.entries.is_empty() diff --git a/lib/src/op_store.rs b/lib/src/op_store.rs index 70c0f92f7..bb41eaebc 100644 --- a/lib/src/op_store.rs +++ b/lib/src/op_store.rs @@ -87,7 +87,7 @@ impl RefTarget { } } -#[derive(PartialEq, Eq, Clone, Debug)] +#[derive(Default, PartialEq, Eq, Clone, Debug)] pub struct BranchTarget { /// The commit the branch points to locally. `None` if the branch has been /// deleted locally. @@ -99,15 +99,6 @@ pub struct BranchTarget { pub remote_targets: BTreeMap, } -impl Default for BranchTarget { - fn default() -> Self { - BranchTarget { - local_target: None, - remote_targets: Default::default(), - } - } -} - /// Represents the way the repo looks at a given time, just like how a Tree /// object represents how the file system looks at a given time. #[derive(PartialEq, Eq, Clone, Debug)] diff --git a/lib/src/settings.rs b/lib/src/settings.rs index e15a06134..fa0db5b52 100644 --- a/lib/src/settings.rs +++ b/lib/src/settings.rs @@ -21,7 +21,7 @@ pub struct UserSettings { #[derive(Debug, Clone)] pub struct RepoSettings { - config: config::Config, + _config: config::Config, } impl UserSettings { @@ -51,7 +51,7 @@ impl UserSettings { .format(config::FileFormat::Toml), )?; - Ok(RepoSettings { config }) + Ok(RepoSettings { _config: config }) } pub fn user_name(&self) -> String {