From 439130574365383e595616565c951020cea3954c Mon Sep 17 00:00:00 2001 From: Reilly Wood Date: Wed, 5 Jun 2024 19:48:37 -0700 Subject: [PATCH] fmt, clippy --- crates/nu-explore/src/explore.rs | 6 ++---- crates/nu-explore/src/lib.rs | 2 +- crates/nu-explore/src/nu_common/mod.rs | 2 +- crates/nu-explore/src/nu_common/value.rs | 4 ---- crates/nu-explore/src/pager/mod.rs | 6 +++--- crates/nu-explore/src/views/binary/mod.rs | 2 +- crates/nu-explore/src/views/try.rs | 2 +- 7 files changed, 9 insertions(+), 15 deletions(-) diff --git a/crates/nu-explore/src/explore.rs b/crates/nu-explore/src/explore.rs index fb6df24ed5..e5498ce5b3 100644 --- a/crates/nu-explore/src/explore.rs +++ b/crates/nu-explore/src/explore.rs @@ -1,6 +1,6 @@ use crate::{ run_pager, - util::{create_lscolors, create_map, map_into_value}, + util::{create_lscolors, create_map}, PagerConfig, }; use nu_ansi_term::{Color, Style}; @@ -8,8 +8,6 @@ use nu_color_config::{get_color_map, StyleComputer}; use nu_engine::command_prelude::*; use nu_protocol::Config; -use std::collections::HashMap; - /// A `less` like program to render a [`Value`] as a table. #[derive(Clone)] pub struct Explore; @@ -69,7 +67,7 @@ impl Command for Explore { let nu_config = engine_state.get_config(); let style_computer = StyleComputer::from_config(engine_state, stack); - let mut explore_config = ExploreConfig::from_nu_config(&nu_config); + let mut explore_config = ExploreConfig::from_nu_config(nu_config); explore_config.table.show_header = show_head; explore_config.table.show_index = show_index; explore_config.table.separator_style = lookup_color(&style_computer, "separator"); diff --git a/crates/nu-explore/src/lib.rs b/crates/nu-explore/src/lib.rs index b80f643862..562602c394 100644 --- a/crates/nu-explore/src/lib.rs +++ b/crates/nu-explore/src/lib.rs @@ -21,7 +21,7 @@ use terminal_size::{Height, Width}; use views::{BinaryView, Orientation, Preview, RecordView}; mod util { - pub use super::nu_common::{create_lscolors, create_map, map_into_value}; + pub use super::nu_common::{create_lscolors, create_map}; } fn run_pager( diff --git a/crates/nu-explore/src/nu_common/mod.rs b/crates/nu-explore/src/nu_common/mod.rs index 78bb61db72..091a7d6f36 100644 --- a/crates/nu-explore/src/nu_common/mod.rs +++ b/crates/nu-explore/src/nu_common/mod.rs @@ -18,7 +18,7 @@ pub use command::run_command_with_value; pub use lscolor::{create_lscolors, lscolorize}; pub use string::{string_width, truncate_str}; pub use table::try_build_table; -pub use value::{collect_input, collect_pipeline, create_map, map_into_value}; +pub use value::{collect_input, collect_pipeline, create_map}; pub fn has_simple_value(data: &[Vec]) -> Option<&Value> { if data.len() == 1 diff --git a/crates/nu-explore/src/nu_common/value.rs b/crates/nu-explore/src/nu_common/value.rs index 8aa71a28bf..ae90278358 100644 --- a/crates/nu-explore/src/nu_common/value.rs +++ b/crates/nu-explore/src/nu_common/value.rs @@ -176,10 +176,6 @@ pub fn create_map(value: &Value) -> Option> { ) } -pub fn map_into_value(hm: HashMap) -> Value { - Value::record(hm.into_iter().collect(), NuSpan::unknown()) -} - fn unknown_error_value() -> Value { Value::string(String::from("❎"), NuSpan::unknown()) } diff --git a/crates/nu-explore/src/pager/mod.rs b/crates/nu-explore/src/pager/mod.rs index fbacf7d223..a56df95bc7 100644 --- a/crates/nu-explore/src/pager/mod.rs +++ b/crates/nu-explore/src/pager/mod.rs @@ -375,13 +375,13 @@ fn draw_info(f: &mut Frame, pager: &mut Pager<'_>, info: ViewInfo) { if let Some(report) = info.status { let last_2nd_line = area.bottom().saturating_sub(2); let area = Rect::new(area.left(), last_2nd_line, area.width, 1); - render_status_bar(f, area, report, &pager.config.explore_config); + render_status_bar(f, area, report, pager.config.explore_config); } { let last_line = area.bottom().saturating_sub(1); let area = Rect::new(area.left(), last_line, area.width, 1); - render_cmd_bar(f, area, pager, info.report, &pager.config.explore_config); + render_cmd_bar(f, area, pager, info.report, pager.config.explore_config); } } @@ -389,7 +389,7 @@ fn create_view_config<'a>(pager: &'a Pager<'_>) -> ViewConfig<'a> { let cfg = &pager.config; ViewConfig::new( cfg.nu_config, - &cfg.explore_config, + cfg.explore_config, cfg.style_computer, cfg.lscolors, ) diff --git a/crates/nu-explore/src/views/binary/mod.rs b/crates/nu-explore/src/views/binary/mod.rs index 37b2eef8ea..f288861be8 100644 --- a/crates/nu-explore/src/views/binary/mod.rs +++ b/crates/nu-explore/src/views/binary/mod.rs @@ -89,7 +89,7 @@ impl View for BinaryView { } fn setup(&mut self, cfg: ViewConfig<'_>) { - self.settings = settings_from_config(&cfg.explore_config); + self.settings = settings_from_config(cfg.explore_config); let count_rows = BinaryWidget::new(&self.data, self.settings.opts, Default::default()).count_lines(); diff --git a/crates/nu-explore/src/views/try.rs b/crates/nu-explore/src/views/try.rs index 83bb8032b1..0f5043847f 100644 --- a/crates/nu-explore/src/views/try.rs +++ b/crates/nu-explore/src/views/try.rs @@ -246,7 +246,7 @@ impl View for TryView<'_> { let mut r = RecordView::new(vec![], vec![]); r.setup(config); - self.table_theme = config.explore_config.table.clone(); + self.table_theme = config.explore_config.table; if let Some(view) = &mut self.table { view.set_orientation(r.get_orientation_current());