diff --git a/lib/src/op_store.rs b/lib/src/op_store.rs index 80a9172b1..3d74c7f55 100644 --- a/lib/src/op_store.rs +++ b/lib/src/op_store.rs @@ -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 } diff --git a/lib/src/repo.rs b/lib/src/repo.rs index 51dab11d8..36b633919 100644 --- a/lib/src/repo.rs +++ b/lib/src/repo.rs @@ -315,14 +315,8 @@ pub struct BackendFactories { factories: HashMap, } -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);