resolve and add even more pedantic clippy lints

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-22 22:44:31 -04:00 committed by June
parent 0bb5115bd1
commit 3bc2af7d26
32 changed files with 167 additions and 167 deletions

View file

@ -367,7 +367,7 @@ impl Service {
// The original create event must be in the auth events
if !matches!(
auth_events.get(&(StateEventType::RoomCreate, "".to_owned())).map(AsRef::as_ref),
auth_events.get(&(StateEventType::RoomCreate, String::new())).map(AsRef::as_ref),
Some(_) | None
) {
return Err(Error::BadRequest(

View file

@ -713,7 +713,7 @@ fn is_accessable_child_recurse(
return Ok(true);
}
},
_ => (),
Identifier::None => (),
} // Takes care of joinrules
Ok(match join_rule {
SpaceRoomJoinRule::KnockRestricted | SpaceRoomJoinRule::Restricted => {
@ -734,6 +734,7 @@ fn is_accessable_child_recurse(
false
},
SpaceRoomJoinRule::Public | SpaceRoomJoinRule::Knock => true,
#[allow(clippy::match_same_arms)]
SpaceRoomJoinRule::Invite | SpaceRoomJoinRule::Private => false,
// Custom join rule
_ => false,
@ -828,7 +829,7 @@ fn allowed_room_ids(join_rule: JoinRule) -> Vec<OwnedRoomId> {
room_id: membership,
}) = rule
{
room_ids.push(membership.to_owned());
room_ids.push(membership.clone());
}
}
}

View file

@ -9,7 +9,7 @@ pub trait Data: Send + Sync {
/// Returns the last state hash key added to the db for the given room.
fn get_room_shortstatehash(&self, room_id: &RoomId) -> Result<Option<u64>>;
/// Set the state hash to a new version, but does not update state_cache.
/// Set the state hash to a new version, but does not update `state_cache`.
fn set_room_state(
&self,
room_id: &RoomId,
@ -20,7 +20,7 @@ pub trait Data: Send + Sync {
/// Associates a state with an event.
fn set_event_state(&self, shorteventid: u64, shortstatehash: u64) -> Result<()>;
/// Returns all events we would send as the prev_events of the next event.
/// Returns all events we would send as the `prev_events` of the next event.
fn get_forward_extremities(&self, room_id: &RoomId) -> Result<HashSet<Arc<EventId>>>;
/// Replace the forward extremities of the room.

View file

@ -230,9 +230,7 @@ impl Service {
pub fn get_name(&self, room_id: &RoomId) -> Result<Option<String>> {
services().rooms.state_accessor.room_state_get(room_id, &StateEventType::RoomName, "")?.map_or(Ok(None), |s| {
Ok(serde_json::from_str(s.content.get())
.map(|c: RoomNameEventContent| Some(c.name))
.unwrap_or_else(|_| None))
Ok(serde_json::from_str(s.content.get()).map_or_else(|_| None, |c: RoomNameEventContent| Some(c.name)))
})
}

View file

@ -680,7 +680,7 @@ impl Service {
&mut pdu_json,
&room_version_id,
) {
Ok(_) => {},
Ok(()) => {},
Err(e) => {
return match e {
ruma::signatures::Error::PduSize => {