diff options
author | Matthias Beyer <matthias.beyer@ifm.com> | 2022-02-17 09:16:31 +0100 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-02-21 08:28:31 +0100 |
commit | a6d5d96ea288cecd52486772eb74287efddc44f6 (patch) | |
tree | 774fac0cd0332c38262794bbe73382577ed89c0e /crates/core/c8y_smartrest | |
parent | fe797c95f33b9baa5aa426b67967ba0ca65c954b (diff) |
Fix: Use Default impl instead of new() without arguments
This fixes the clippy lint `clippy::new_without_default`.
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
Diffstat (limited to 'crates/core/c8y_smartrest')
-rw-r--r-- | crates/core/c8y_smartrest/src/operations.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/core/c8y_smartrest/src/operations.rs b/crates/core/c8y_smartrest/src/operations.rs index b3909aac..7fec5cd7 100644 --- a/crates/core/c8y_smartrest/src/operations.rs +++ b/crates/core/c8y_smartrest/src/operations.rs @@ -49,14 +49,16 @@ pub struct Operations { operations_by_trigger: HashMap<String, usize>, } -impl Operations { - pub fn new() -> Self { +impl Default for Operations { + fn default() -> Self { Self { operations: vec![], operations_by_trigger: HashMap::new(), } } +} +impl Operations { pub fn add(&mut self, operation: Operation) { if let Some(detail) = operation.exec() { if let Some(on_message) = &detail.on_message { @@ -93,7 +95,7 @@ impl Operations { } fn get_operations(dir: impl AsRef<Path>, cloud_name: &str) -> Result<Operations, OperationsError> { - let mut operations = Operations::new(); + let mut operations = Operations::default(); let path = dir.as_ref().join(&cloud_name); let dir_entries = fs::read_dir(&path)? |