This commit is contained in:
Chris Tsang 2022-11-28 13:04:25 +08:00
parent f3910c329b
commit 1b4e1670f7

View File

@ -81,11 +81,7 @@ where
let result: Vec<Option<<R as EntityTrait>::Model>> = keys let result: Vec<Option<<R as EntityTrait>::Model>> = keys
.iter() .iter()
.map(|key| { .map(|key| hashmap.get(&format!("{:?}", key)).cloned())
hashmap
.get(&format!("{:?}", key))
.and_then(|val| Some(val.clone()))
})
.collect(); .collect();
Ok(result) Ok(result)
@ -143,8 +139,8 @@ where
.map(|key: &ValueTuple| { .map(|key: &ValueTuple| {
hashmap hashmap
.get(&format!("{:?}", key)) .get(&format!("{:?}", key))
.and_then(|val| Some(val.clone())) .cloned()
.unwrap_or_else(|| vec![]) .unwrap_or_default()
}) })
.collect(); .collect();