cleanup: fix issues found by latest rustc and clippy

This commit is contained in:
Martin von Zweigbergk 2021-09-29 10:08:12 -07:00
parent eb00981aca
commit de5bf90675
3 changed files with 5 additions and 31 deletions

View file

@ -172,7 +172,7 @@ pub struct ConflictPart {
pub value: TreeValue, pub value: TreeValue,
} }
#[derive(Debug, PartialEq, Eq, Clone)] #[derive(Default, Debug, PartialEq, Eq, Clone)]
pub struct Conflict { pub struct Conflict {
// A conflict is represented by a list of positive and negative states that need to be applied. // 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], // 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<ConflictPart>, pub adds: Vec<ConflictPart>,
} }
impl Default for Conflict {
fn default() -> Self {
Conflict {
removes: Default::default(),
adds: Default::default(),
}
}
}
#[derive(Debug, Error, PartialEq, Eq)] #[derive(Debug, Error, PartialEq, Eq)]
pub enum BackendError { pub enum BackendError {
#[error("Object not found")] #[error("Object not found")]
@ -244,19 +235,11 @@ impl<'a> Iterator for TreeEntriesNonRecursiveIter<'a> {
} }
} }
#[derive(Debug, Clone)] #[derive(Default, Debug, Clone)]
pub struct Tree { pub struct Tree {
entries: BTreeMap<RepoPathComponent, TreeValue>, entries: BTreeMap<RepoPathComponent, TreeValue>,
} }
impl Default for Tree {
fn default() -> Self {
Self {
entries: BTreeMap::new(),
}
}
}
impl Tree { impl Tree {
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
self.entries.is_empty() self.entries.is_empty()

View file

@ -87,7 +87,7 @@ impl RefTarget {
} }
} }
#[derive(PartialEq, Eq, Clone, Debug)] #[derive(Default, PartialEq, Eq, Clone, Debug)]
pub struct BranchTarget { pub struct BranchTarget {
/// The commit the branch points to locally. `None` if the branch has been /// The commit the branch points to locally. `None` if the branch has been
/// deleted locally. /// deleted locally.
@ -99,15 +99,6 @@ pub struct BranchTarget {
pub remote_targets: BTreeMap<String, RefTarget>, pub remote_targets: BTreeMap<String, RefTarget>,
} }
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 /// 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. /// object represents how the file system looks at a given time.
#[derive(PartialEq, Eq, Clone, Debug)] #[derive(PartialEq, Eq, Clone, Debug)]

View file

@ -21,7 +21,7 @@ pub struct UserSettings {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct RepoSettings { pub struct RepoSettings {
config: config::Config, _config: config::Config,
} }
impl UserSettings { impl UserSettings {
@ -51,7 +51,7 @@ impl UserSettings {
.format(config::FileFormat::Toml), .format(config::FileFormat::Toml),
)?; )?;
Ok(RepoSettings { config }) Ok(RepoSettings { _config: config })
} }
pub fn user_name(&self) -> String { pub fn user_name(&self) -> String {