From 143350edcc35444432dee2eec749c5b5f5ceb824 Mon Sep 17 00:00:00 2001 From: susiyaki Date: Wed, 3 Nov 2021 16:39:00 +0900 Subject: [PATCH] fix type error --- src/components/connections.rs | 2 +- src/config.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/connections.rs b/src/components/connections.rs index e2e4f43..659f3db 100644 --- a/src/components/connections.rs +++ b/src/components/connections.rs @@ -89,7 +89,7 @@ impl StatefulDrawableComponent for ConnectionsComponent { let mut connections: Vec = Vec::new(); for c in conns { connections.push( - ListItem::new(vec![Spans::from(Span::raw(c.database_url_with_name()))]) + ListItem::new(vec![Spans::from(Span::raw(c.database_url_with_name()?))]) .style(Style::default()), ) } diff --git a/src/config.rs b/src/config.rs index 620fc65..3d41831 100644 --- a/src/config.rs +++ b/src/config.rs @@ -267,17 +267,17 @@ impl Connection { } } - pub fn database_url_with_name(&self) -> std::string::String { + pub fn database_url_with_name(&self) -> anyhow::Result { let database_url = self.database_url()?; - match &self.name { + Ok(match &self.name { Some(name) => format!( "[{name}] {database_url}", name = name, database_url = database_url ), None => database_url, - } + }) } pub fn is_mysql(&self) -> bool {