mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-16 00:56:23 +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 {
|
impl WorkspaceId {
|
||||||
pub fn new(value: String) -> Self {
|
pub fn new(value: String) -> Self {
|
||||||
Self(value)
|
Self(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default() -> Self {
|
|
||||||
Self("default".to_string())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn as_str(&self) -> &str {
|
pub fn as_str(&self) -> &str {
|
||||||
&self.0
|
&self.0
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,14 +315,8 @@ pub struct BackendFactories {
|
||||||
factories: HashMap<String, BackendFactory>,
|
factories: HashMap<String, BackendFactory>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BackendFactories {
|
impl Default for BackendFactories {
|
||||||
pub fn empty() -> Self {
|
fn default() -> Self {
|
||||||
BackendFactories {
|
|
||||||
factories: HashMap::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn default() -> Self {
|
|
||||||
let mut factories = BackendFactories::empty();
|
let mut factories = BackendFactories::empty();
|
||||||
factories.add_backend(
|
factories.add_backend(
|
||||||
"local",
|
"local",
|
||||||
|
@ -334,6 +328,14 @@ impl BackendFactories {
|
||||||
);
|
);
|
||||||
factories
|
factories
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BackendFactories {
|
||||||
|
pub fn empty() -> Self {
|
||||||
|
BackendFactories {
|
||||||
|
factories: HashMap::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn add_backend(&mut self, name: &str, factory: BackendFactory) {
|
pub fn add_backend(&mut self, name: &str, factory: BackendFactory) {
|
||||||
self.factories.insert(name.to_string(), factory);
|
self.factories.insert(name.to_string(), factory);
|
||||||
|
|
Loading…
Reference in a new issue