1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-11-04 09:34:04 +00:00

Improve code

This commit is contained in:
2020-07-07 19:19:18 +02:00
parent c82e9d6e69
commit ea1ed285f8
2 changed files with 9 additions and 8 deletions

View File

@@ -75,10 +75,8 @@ pub fn create(p: &Post) -> ResultBoxError<u64> {
.add_opt_str("texte", p.content.as_ref());
// Execute insertion
let post_id = match insert_query.insert()? {
None => Err(ExecError::new("Insert post query did not return a result!")),
Some(id) => Ok(id),
}?;
let post_id = insert_query.insert()?
.ok_or(ExecError::new("Insert post query did not return a result!"))?;
Ok(post_id)
}