diff options
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/impl_self.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/app/impl_self.rs b/src/app/impl_self.rs index 38162ee..8a84cb2 100644 --- a/src/app/impl_self.rs +++ b/src/app/impl_self.rs | |||
@@ -34,10 +34,7 @@ impl App { | |||
34 | } | 34 | } |
35 | 35 | ||
36 | pub fn list_habit(&self) -> Vec<String> { | 36 | pub fn list_habit(&self) -> Vec<String> { |
37 | let mut habits_names: Vec<String> = vec![]; | 37 | let habits_names = self.habits.iter().map(|x| x.name()).collect::<Vec<_>>(); |
38 | for h in self.habits.iter() { | ||
39 | habits_names.push(h.name()) | ||
40 | } | ||
41 | return habits_names; | 38 | return habits_names; |
42 | } | 39 | } |
43 | 40 | ||
@@ -49,6 +46,7 @@ impl App { | |||
49 | .count() | 46 | .count() |
50 | > 0 | 47 | > 0 |
51 | { | 48 | { |
49 | self.message.set_kind(MessageKind::Error); | ||
52 | self.message | 50 | self.message |
53 | .set_message(format!("Habit `{}` allready exist", h.name())) | 51 | .set_message(format!("Habit `{}` allready exist", h.name())) |
54 | } else { | 52 | } else { |