summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/types.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/types.rs b/src/types.rs
index 3dcb6db..1efd9c1 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -168,15 +168,13 @@ impl std::fmt::Display for Train {
#[allow(unstable_name_collisions)]
impl std::fmt::Display for Trip<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- if self.0.len() == 0 {
- write!(f, "(none)")
- } else {
- self.0.iter()
- .map(|stop| stop.to_fancy_string())
- .intersperse(" ↓".to_string())
- .for_each(|l| writeln!(f, " {}", l).unwrap());
- Ok(())
+ if self.0.len() != 0 {
+ self.0.iter()
+ .map(|stop| stop.to_fancy_string())
+ // .intersperse(" ↓".to_string())
+ .for_each(|l| writeln!(f, " {}\n ↓", l).unwrap());
}
+ Ok(())
}
}
@@ -187,14 +185,14 @@ impl std::fmt::Display for Status {
false => write!(
f,
"not checked in. \n\n\
- last trip: \n {}\n ↓\n {}",
+ last trip: \n {} {}",
self.from_station.to_fancy_string(),
self.to_station.as_ref().unwrap().to_fancy_string()
),
true => write!(
f,
"checked in to: {}.\n\n\
- stops:\n {}\n ↓\n{} ↓\n {}",
+ stops:\n {}\n ↓\n{} {}",
self.train.as_ref().map(|t| t.to_string()).unwrap_or("".to_string()).green(),
self.from_station.to_fancy_string(),
Trip(&self.intermediate_stops),