[fractal] backend: simplify get_alias method of Member



commit 2c30cdfd3014579b5c93e08ba312dc9199f2372c
Author: Julian Sparber <julian sparber net>
Date:   Thu Jan 3 02:12:44 2019 +0100

    backend: simplify get_alias method of Member

 fractal-matrix-api/src/model/member.rs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/fractal-matrix-api/src/model/member.rs b/fractal-matrix-api/src/model/member.rs
index 521617e3..0e8dfcdb 100644
--- a/fractal-matrix-api/src/model/member.rs
+++ b/fractal-matrix-api/src/model/member.rs
@@ -15,10 +15,12 @@ pub struct Member {
 
 impl Member {
     pub fn get_alias(&self) -> String {
-        match self.alias {
-            ref a if a.is_none() || a.clone().unwrap().is_empty() => self.uid.clone(),
-            ref a => a.as_ref().unwrap().clone(),
+        if let Some(ref alias) = self.alias {
+            if !alias.is_empty() {
+                return alias.clone();
+            }
         }
+        self.uid.clone()
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]