mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-28 23:55:54 +00:00
cleanup: move default()
functions to impl Default
As suggested by a newer version of Clippy.
This commit is contained in:
parent
e11540162a
commit
6526b76ef0
2 changed files with 16 additions and 12 deletions
|
@ -28,15 +28,17 @@ impl Debug for WorkspaceId {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for WorkspaceId {
|
||||
fn default() -> Self {
|
||||
Self("default".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl WorkspaceId {
|
||||
pub fn new(value: String) -> Self {
|
||||
Self(value)
|
||||
}
|
||||
|
||||
pub fn default() -> Self {
|
||||
Self("default".to_string())
|
||||
}
|
||||
|
||||
pub fn as_str(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
|
|
|
@ -315,14 +315,8 @@ pub struct BackendFactories {
|
|||
factories: HashMap<String, BackendFactory>,
|
||||
}
|
||||
|
||||
impl BackendFactories {
|
||||
pub fn empty() -> Self {
|
||||
BackendFactories {
|
||||
factories: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default() -> Self {
|
||||
impl Default for BackendFactories {
|
||||
fn default() -> Self {
|
||||
let mut factories = BackendFactories::empty();
|
||||
factories.add_backend(
|
||||
"local",
|
||||
|
@ -334,6 +328,14 @@ impl BackendFactories {
|
|||
);
|
||||
factories
|
||||
}
|
||||
}
|
||||
|
||||
impl BackendFactories {
|
||||
pub fn empty() -> Self {
|
||||
BackendFactories {
|
||||
factories: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_backend(&mut self, name: &str, factory: BackendFactory) {
|
||||
self.factories.insert(name.to_string(), factory);
|
||||
|
|
Loading…
Reference in a new issue