From 69c8914b03ceff2948c1bc32b335ad80d5f65405 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 24 Jul 2020 20:49:18 +0200 Subject: [PATCH] ruma-common: Small refactorings in any_push_rule.rs * Make field order consistent * Use `Self` type alias for shorter code --- ruma-common/src/push/any_push_rule.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/ruma-common/src/push/any_push_rule.rs b/ruma-common/src/push/any_push_rule.rs index e6930d1c..68517d5b 100644 --- a/ruma-common/src/push/any_push_rule.rs +++ b/ruma-common/src/push/any_push_rule.rs @@ -37,28 +37,21 @@ pub struct AnyPushRule { impl From for AnyPushRule { fn from(push_rule: PushRule) -> Self { let PushRule { actions, default, enabled, rule_id } = push_rule; - AnyPushRule { actions, default, enabled, rule_id, pattern: None, conditions: None } + Self { actions, default, enabled, rule_id, conditions: None, pattern: None } } } impl From for AnyPushRule { fn from(push_rule: PatternedPushRule) -> Self { let PatternedPushRule { actions, default, enabled, rule_id, pattern } = push_rule; - AnyPushRule { actions, default, enabled, rule_id, pattern: Some(pattern), conditions: None } + Self { actions, default, enabled, rule_id, conditions: None, pattern: Some(pattern) } } } impl From for AnyPushRule { fn from(push_rule: ConditionalPushRule) -> Self { let ConditionalPushRule { actions, default, enabled, rule_id, conditions } = push_rule; - AnyPushRule { - actions, - default, - enabled, - rule_id, - pattern: None, - conditions: Some(conditions), - } + Self { actions, default, enabled, rule_id, conditions: Some(conditions), pattern: None } } }