lunar-mining 4 лет назад
Родитель
Сommit
c6ca1b4c6d
2 измененных файлов с 9 добавлено и 12 удалено
  1. 3 4
      bin/map/src/main.rs
  2. 6 8
      bin/map/src/ui.rs

+ 3 - 4
bin/map/src/main.rs

@@ -13,14 +13,13 @@ use easy_parallel::Parallel;
 use log::{debug, info};
 use serde_json::{json, Value};
 use simplelog::*;
-use smol::{Executor, Timer};
+use smol::Executor;
 use std::{
     collections::{HashMap, HashSet},
     fs::File,
     io,
     io::Read,
     path::PathBuf,
-    time::Duration,
 };
 use termion::{async_stdin, event::Key, input::TermRead, raw::IntoRawMode};
 use tui::{
@@ -74,7 +73,7 @@ impl Map {
 
     // --> {"jsonrpc": "2.0", "method": "ping", "params": [], "id": 42}
     // <-- {"jsonrpc": "2.0", "result": "pong", "id": 42}
-    async fn ping(&self) -> Result<Value> {
+    async fn _ping(&self) -> Result<Value> {
         let req = jsonrpc::request(json!("ping"), json!([]));
         Ok(self.request(req).await?)
     }
@@ -265,7 +264,7 @@ async fn render<B: Backend>(terminal: &mut Terminal<B>, model: Arc<Model>) -> io
             match k.unwrap() {
                 Key::Char('q') => {
                     terminal.clear()?;
-                    return Ok(())
+                    return Ok(());
                 }
                 Key::Char('j') => {
                     view.id_list.next();

+ 6 - 8
bin/map/src/ui.rs

@@ -1,13 +1,11 @@
-use crate::{model::NodeInfo, view::View};
-use log::debug;
-use std::collections::HashMap;
+use crate::view::View;
 
 use tui::{
     backend::Backend,
     layout::{Alignment, Constraint, Direction, Layout, Rect},
-    style::{Color, Style},
+    style::Style,
     text::{Span, Spans},
-    widgets::{Block, Borders, Gauge, List, ListItem, Paragraph},
+    widgets::{Block, Borders, List, ListItem, Paragraph},
     Frame,
 };
 
@@ -41,11 +39,11 @@ pub fn ui<B: Backend>(f: &mut Frame<'_, B>, mut view: View) {
 
     let index = view.info_list.index;
 
-    render_info_left(view.clone(), f, index, slice.clone());
-    render_info_right(view.clone(), f, index, slice.clone());
+    render_info_left(view.clone(), f, index);
+    render_info_right(view.clone(), f, index, slice);
 }
 
-fn render_info_left<B: Backend>(view: View, f: &mut Frame<'_, B>, _index: usize, slice: Vec<Rect>) {
+fn render_info_left<B: Backend>(view: View, f: &mut Frame<'_, B>, _index: usize) {
     let slice = Layout::default()
         .direction(Direction::Horizontal)
         .horizontal_margin(8)