Simplify default Result generics.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -64,12 +64,7 @@ impl crate::Service for Service {
|
||||
|
||||
impl Service {
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub fn set_alias(
|
||||
&self,
|
||||
alias: &RoomAliasId,
|
||||
room_id: &RoomId,
|
||||
user_id: &UserId,
|
||||
) -> Result<()> {
|
||||
pub fn set_alias(&self, alias: &RoomAliasId, room_id: &RoomId, user_id: &UserId) -> Result {
|
||||
if alias == self.services.globals.admin_alias
|
||||
&& user_id != self.services.globals.server_user
|
||||
{
|
||||
@@ -96,7 +91,7 @@ impl Service {
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub async fn remove_alias(&self, alias: &RoomAliasId, user_id: &UserId) -> Result<()> {
|
||||
pub async fn remove_alias(&self, alias: &RoomAliasId, user_id: &UserId) -> Result {
|
||||
if !self.user_can_remove_alias(alias, user_id).await? {
|
||||
return Err!(Request(Forbidden("User is not permitted to remove this alias.")));
|
||||
}
|
||||
@@ -295,7 +290,7 @@ impl Service {
|
||||
&self,
|
||||
room_alias: &RoomAliasId,
|
||||
appservice_info: &Option<RegistrationInfo>,
|
||||
) -> Result<()> {
|
||||
) -> Result {
|
||||
if !self
|
||||
.services
|
||||
.globals
|
||||
|
||||
@@ -24,7 +24,7 @@ use super::ExtractBody;
|
||||
|
||||
#[implement(super::Service)]
|
||||
#[tracing::instrument(name = "backfill", level = "debug", skip(self))]
|
||||
pub async fn backfill_if_required(&self, room_id: &RoomId, from: PduCount) -> Result<()> {
|
||||
pub async fn backfill_if_required(&self, room_id: &RoomId, from: PduCount) -> Result {
|
||||
if self
|
||||
.services
|
||||
.state_cache
|
||||
@@ -143,7 +143,7 @@ pub async fn backfill_if_required(&self, room_id: &RoomId, from: PduCount) -> Re
|
||||
|
||||
#[implement(super::Service)]
|
||||
#[tracing::instrument(skip(self, pdu), level = "debug")]
|
||||
pub async fn backfill_pdu(&self, origin: &ServerName, pdu: Box<RawJsonValue>) -> Result<()> {
|
||||
pub async fn backfill_pdu(&self, origin: &ServerName, pdu: Box<RawJsonValue>) -> Result {
|
||||
let (room_id, event_id, value) = self
|
||||
.services
|
||||
.event_handler
|
||||
|
||||
@@ -51,12 +51,7 @@ impl crate::Service for Service {
|
||||
impl Service {
|
||||
/// Sets a user as typing until the timeout timestamp is reached or
|
||||
/// roomtyping_remove is called.
|
||||
pub async fn typing_add(
|
||||
&self,
|
||||
user_id: &UserId,
|
||||
room_id: &RoomId,
|
||||
timeout: u64,
|
||||
) -> Result<()> {
|
||||
pub async fn typing_add(&self, user_id: &UserId, room_id: &RoomId, timeout: u64) -> Result {
|
||||
debug_info!("typing started {user_id:?} in {room_id:?} timeout:{timeout:?}");
|
||||
// update clients
|
||||
self.typing
|
||||
@@ -89,7 +84,7 @@ impl Service {
|
||||
}
|
||||
|
||||
/// Removes a user from typing before the timeout is reached.
|
||||
pub async fn typing_remove(&self, user_id: &UserId, room_id: &RoomId) -> Result<()> {
|
||||
pub async fn typing_remove(&self, user_id: &UserId, room_id: &RoomId) -> Result {
|
||||
debug_info!("typing stopped {user_id:?} in {room_id:?}");
|
||||
// update clients
|
||||
self.typing
|
||||
@@ -131,7 +126,7 @@ impl Service {
|
||||
}
|
||||
|
||||
/// Makes sure that typing events with old timestamps get removed.
|
||||
async fn typings_maintain(&self, room_id: &RoomId) -> Result<()> {
|
||||
async fn typings_maintain(&self, room_id: &RoomId) -> Result {
|
||||
let current_timestamp = utils::millis_since_unix_epoch();
|
||||
let mut removable = Vec::new();
|
||||
|
||||
@@ -226,12 +221,7 @@ impl Service {
|
||||
})
|
||||
}
|
||||
|
||||
async fn federation_send(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
user_id: &UserId,
|
||||
typing: bool,
|
||||
) -> Result<()> {
|
||||
async fn federation_send(&self, room_id: &RoomId, user_id: &UserId, typing: bool) -> Result {
|
||||
debug_assert!(
|
||||
self.services.globals.user_is_local(user_id),
|
||||
"tried to broadcast typing status of remote user",
|
||||
|
||||
Reference in New Issue
Block a user