Skip to content

Commit

Permalink
fix: clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kruserr committed May 26, 2024
1 parent 8342945 commit 51f4a63
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions rapiddb/src/db/mmav_db/mmav_async_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ impl MMAVAsyncDatabase {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(&file_name)
.unwrap_or_else(|error| {
if error.kind() == std::io::ErrorKind::NotFound {
Expand All @@ -126,6 +127,7 @@ impl MMAVAsyncDatabase {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(file_name)
.unwrap()
});
Expand Down Expand Up @@ -155,7 +157,7 @@ impl Default for MMAVAsyncDatabase {
#[async_trait::async_trait]
impl IAsyncDatabase for MMAVAsyncDatabase {
async fn contains(&self, id: &str) -> bool {
self.sensors.get(id).is_some()
self.sensors.contains_key(id)
}

async fn get(&mut self, id: &str, rec_id: usize) -> Vec<u8> {
Expand Down Expand Up @@ -215,6 +217,7 @@ impl IAsyncDatabase for MMAVAsyncDatabase {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(&file_name)
.unwrap_or_else(|error| {
if error.kind() == std::io::ErrorKind::NotFound {
Expand All @@ -234,6 +237,7 @@ impl IAsyncDatabase for MMAVAsyncDatabase {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(file_name)
.unwrap()
});
Expand All @@ -243,7 +247,7 @@ impl IAsyncDatabase for MMAVAsyncDatabase {
}

async fn get_aggregates(&self, id: &str) -> Vec<u8> {
if self.aggregates.get(id).is_none() {
if !self.aggregates.contains_key(id) {
return Default::default();
}

Expand Down
8 changes: 6 additions & 2 deletions rapiddb/src/db/mmav_db/mmav_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ impl MMAVDatabase {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(&file_name)
.unwrap_or_else(|error| {
if error.kind() == std::io::ErrorKind::NotFound {
Expand All @@ -126,6 +127,7 @@ impl MMAVDatabase {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(file_name)
.unwrap()
});
Expand Down Expand Up @@ -154,7 +156,7 @@ impl Default for MMAVDatabase {
}
impl IDatabase for MMAVDatabase {
fn contains(&self, id: &str) -> bool {
self.sensors.get(id).is_some()
self.sensors.contains_key(id)
}

fn get(&mut self, id: &str, rec_id: usize) -> Vec<u8> {
Expand Down Expand Up @@ -214,6 +216,7 @@ impl IDatabase for MMAVDatabase {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(&file_name)
.unwrap_or_else(|error| {
if error.kind() == std::io::ErrorKind::NotFound {
Expand All @@ -233,6 +236,7 @@ impl IDatabase for MMAVDatabase {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(file_name)
.unwrap()
});
Expand All @@ -242,7 +246,7 @@ impl IDatabase for MMAVDatabase {
}

fn get_aggregates(&self, id: &str) -> Vec<u8> {
if self.aggregates.get(id).is_none() {
if !self.aggregates.contains_key(id) {
return Default::default();
}

Expand Down
2 changes: 2 additions & 0 deletions rapiddb/src/db/mmav_db/mmav_unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ impl MMAVUnit {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(file_name)
.unwrap_or_else(|error| {
if error.kind() == std::io::ErrorKind::NotFound {
Expand All @@ -55,6 +56,7 @@ impl MMAVUnit {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(file_name)
.unwrap()
});
Expand Down

0 comments on commit 51f4a63

Please sign in to comment.