diff --git a/server/src/cryp.rs b/server/src/cryp.rs index 3384cb07..458dc7aa 100644 --- a/server/src/cryp.rs +++ b/server/src/cryp.rs @@ -306,7 +306,7 @@ impl Cryp { return Ok(self.recalculate_stats()); } - pub fn spec_remove(mut self, spec: Spec) -> Result { + pub fn spec_remove(&mut self, spec: Spec) -> Result<&mut Cryp, Error> { let find_spec = |spec_v: &Vec| spec_v.iter().position(|s| s.spec == spec.spec); match spec.level { @@ -324,7 +324,7 @@ impl Cryp { }, }; - Ok(self) + Ok(self.recalculate_stats()) } @@ -734,7 +734,7 @@ pub fn cryp_forget(params: CrypForgetParams, tx: &mut Transaction, account: &Acc pub fn cryp_unspec(params: CrypUnspecParams, tx: &mut Transaction, account: &Account) -> Result { let mut cryp = cryp_get(tx, params.id, account.id)?; - cryp = cryp.spec_remove(params.spec)?; + cryp.spec_remove(params.spec)?; return cryp_write(cryp, tx); }