[fractal] backend: simplify get_alias method of Member
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal] backend: simplify get_alias method of Member
- Date: Tue, 15 Jan 2019 15:22:26 +0000 (UTC)
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]