Simplify return type of most route handlers
This commit is contained in:
parent
77a87881c9
commit
5fa9190117
38 changed files with 358 additions and 414 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::{database::DatabaseGuard, ConduitResult, Ruma};
|
||||
use crate::{database::DatabaseGuard, Result, Ruma};
|
||||
use ruma::api::client::r0::user_directory::search_users;
|
||||
|
||||
/// # `POST /_matrix/client/r0/user_directory/search`
|
||||
|
@ -10,7 +10,7 @@ use ruma::api::client::r0::user_directory::search_users;
|
|||
pub async fn search_users_route(
|
||||
db: DatabaseGuard,
|
||||
body: Ruma<search_users::Request<'_>>,
|
||||
) -> ConduitResult<search_users::Response> {
|
||||
) -> Result<search_users::Response> {
|
||||
let limit = u64::from(body.limit) as usize;
|
||||
|
||||
let mut users = db.users.iter().filter_map(|user_id| {
|
||||
|
@ -48,5 +48,5 @@ pub async fn search_users_route(
|
|||
let results = users.by_ref().take(limit).collect();
|
||||
let limited = users.next().is_some();
|
||||
|
||||
Ok(search_users::Response { results, limited }.into())
|
||||
Ok(search_users::Response { results, limited })
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue