From 69161945d9d9246e2a201a405eeeb09bd8b26c62 Mon Sep 17 00:00:00 2001 From: lunar-mining Date: Thu, 10 Mar 2022 08:54:09 +0100 Subject: [PATCH] stop passing Config to ui::ui NodeId is read from config and is initalized into Model. The values from Model are then copied into View. We therefore do not need to read this data in the UI, as it already exists in View. --- bin/dnetview/src/main.rs | 10 +++------- bin/dnetview/src/ui.rs | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/bin/dnetview/src/main.rs b/bin/dnetview/src/main.rs index 41f82d6ee..d06aa5981 100644 --- a/bin/dnetview/src/main.rs +++ b/bin/dnetview/src/main.rs @@ -127,7 +127,7 @@ async fn main() -> Result<()> { .finish(|| { smol::future::block_on(async move { run_rpc(&config, ex2.clone(), model.clone()).await?; - render(&mut terminal, model.clone(), config).await?; + render(&mut terminal, model.clone()).await?; drop(signal); Ok::<(), darkfi::Error>(()) }) @@ -232,11 +232,7 @@ async fn poll(client: Map, model: Arc) -> Result<()> { } } -async fn render( - terminal: &mut Terminal, - model: Arc, - config: DnvConfig, -) -> io::Result<()> { +async fn render(terminal: &mut Terminal, model: Arc) -> io::Result<()> { let mut asi = async_stdin(); terminal.clear()?; @@ -251,7 +247,7 @@ async fn render( loop { view.update(model.info_list.infos.lock().await.clone()); terminal.draw(|f| { - ui::ui(f, view.clone(), &config); + ui::ui(f, view.clone()); })?; for k in asi.by_ref().keys() { match k.unwrap() { diff --git a/bin/dnetview/src/ui.rs b/bin/dnetview/src/ui.rs index 13ce0516d..ff02d8aba 100644 --- a/bin/dnetview/src/ui.rs +++ b/bin/dnetview/src/ui.rs @@ -1,4 +1,4 @@ -use crate::{view::View, DnvConfig}; +use crate::view::View; use tui::{ backend::Backend, @@ -9,7 +9,7 @@ use tui::{ Frame, }; -pub fn ui(f: &mut Frame<'_, B>, mut view: View, config: &DnvConfig) { +pub fn ui(f: &mut Frame<'_, B>, mut view: View) { let slice = Layout::default() .direction(Direction::Horizontal) .margin(2)