mirror of
https://github.com/chatmail/core.git
synced 2026-05-11 10:56:29 +03:00
feat: ensure_and_debug_assert{,_eq,_ne} macros combining debug_assert* and anyhow::ensure (#6907)
We have some debug assertions already, but we also want the corresponding errors in the release configuration so that it's not less reliable than non-optimized one. This doesn't change any function signatures, only debug assertions in functions returning `Result` are replaced. Co-authored-by: l <link2xt@testrun.org>
This commit is contained in:
@@ -37,7 +37,7 @@ use crate::mimeparser::AvatarAction;
|
||||
use crate::param::{Param, Params};
|
||||
use crate::sync::{self, Sync::*};
|
||||
use crate::tools::{SystemTime, duration_to_str, get_abs_path, time};
|
||||
use crate::{chat, chatlist_events, stock_str};
|
||||
use crate::{chat, chatlist_events, ensure_and_debug_assert_ne, stock_str};
|
||||
|
||||
/// Time during which a contact is considered as seen recently.
|
||||
const SEEN_RECENTLY_SECONDS: i64 = 600;
|
||||
@@ -1922,9 +1922,10 @@ pub(crate) async fn mark_contact_id_as_verified(
|
||||
contact_id: ContactId,
|
||||
verifier_id: ContactId,
|
||||
) -> Result<()> {
|
||||
debug_assert_ne!(
|
||||
contact_id, verifier_id,
|
||||
"Contact cannot be verified by self"
|
||||
ensure_and_debug_assert_ne!(
|
||||
contact_id,
|
||||
verifier_id,
|
||||
"Contact cannot be verified by self",
|
||||
);
|
||||
context
|
||||
.sql
|
||||
|
||||
Reference in New Issue
Block a user