common: Remove more unnecessary bounds

This commit is contained in:
Jonas Platte 2022-02-12 01:46:10 +01:00
parent 8f1eae97ce
commit 510b8485d8
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -103,10 +103,7 @@ impl Ruleset {
&self, &self,
event: &Raw<T>, event: &Raw<T>,
context: &PushConditionRoomCtx, context: &PushConditionRoomCtx,
) -> Option<AnyPushRuleRef<'_>> ) -> Option<AnyPushRuleRef<'_>> {
where
T: Serialize,
{
let event = FlattenedJson::from_raw(event); let event = FlattenedJson::from_raw(event);
self.iter().find(|rule| rule.applies(&event, context)) self.iter().find(|rule| rule.applies(&event, context))
} }
@ -119,10 +116,7 @@ impl Ruleset {
/// ///
/// * `event` - The raw JSON of a room message event. /// * `event` - The raw JSON of a room message event.
/// * `context` - The context of the message and room at the time of the event. /// * `context` - The context of the message and room at the time of the event.
pub fn get_actions<T>(&self, event: &Raw<T>, context: &PushConditionRoomCtx) -> &[Action] pub fn get_actions<T>(&self, event: &Raw<T>, context: &PushConditionRoomCtx) -> &[Action] {
where
T: Serialize,
{
self.get_match(event, context).map(|rule| rule.actions()).unwrap_or(&[]) self.get_match(event, context).map(|rule| rule.actions()).unwrap_or(&[])
} }
} }