chore: cleanup

This commit is contained in:
Elias Renman
2023-05-07 15:49:59 +02:00
parent a8a527e037
commit 4c8918f75e
2 changed files with 5 additions and 12 deletions

View File

@@ -42,11 +42,11 @@ impl Index {
if index_row.is_none() {
// Insert the new row into the index
self.index_rows.insert(key, vec![pk_value]);
return Result::Ok(());
return Ok(());
}
if self.unique {
return Result::Err("Index is unique!");
return Err("Index is unique!");
}
let mut vector = index_row.unwrap().clone();
@@ -61,7 +61,7 @@ impl Index {
self.index_rows.insert(key, vector);
return Result::Ok(());
return Ok(());
}
pub fn get_pks_by_value(&self, value: Value) -> Option<&Vec<u64>> {

View File

@@ -1,11 +1,3 @@
macro_rules! hashmapJson {
($( $key: expr => $val: expr ),*) => {{
let mut map: ::std::collections::HashMap<String, ::serde_json::Value> = ::std::collections::HashMap::new();
$( map.insert($key.to_string(), serde_json::to_value($val).unwrap()); )*
map
}}
}
macro_rules! row {
($( $key: expr => $val: expr ),*) => {{
let mut map: crate::database::row::Row = ::std::collections::HashMap::new();
@@ -16,8 +8,9 @@ macro_rules! row {
macro_rules! hashmap {
($( $key: expr => $val: expr ),*) => {{
#[allow(unused_mut)]
let mut map = ::std::collections::HashMap::new();
$( map.insert($key.to_string(), $val );)*
$( map.insert($key.to_string(), $val ); )*
map
}}
}