From 3c1e6d13e94efdd71922e9faccfb89ce424e0097 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Mon, 6 Sep 2021 16:09:30 +0900 Subject: [PATCH] early return error --- src/components/connections.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/connections.rs b/src/components/connections.rs index 6f223ba..455b2c2 100644 --- a/src/components/connections.rs +++ b/src/components/connections.rs @@ -86,13 +86,13 @@ impl DrawableComponent for ConnectionsComponent { let width = 80; let height = 20; let conns = &self.connections; - let connections: Vec = conns - .iter() - .map(|i| { - ListItem::new(vec![Spans::from(Span::raw(i.database_url().unwrap()))]) - .style(Style::default()) - }) - .collect(); + let mut connections: Vec = Vec::new(); + for c in conns { + connections.push( + ListItem::new(vec![Spans::from(Span::raw(c.database_url()?))]) + .style(Style::default()), + ) + } let tasks = List::new(connections) .block(Block::default().borders(Borders::ALL).title("Connections")) .highlight_style(Style::default().bg(Color::Blue))