From af1963d14881a37dcc0a3feb3595084ee303af41 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Wed, 15 May 2019 15:58:44 -0700 Subject: [PATCH] Remove dead code --- src/commands.rs | 1 - src/commands/args.rs | 79 +--------------------------------------- src/commands/cd.rs | 11 ++---- src/commands/ls.rs | 11 ++---- src/commands/ps.rs | 10 ++--- src/commands/reject.rs | 10 ++--- src/commands/select.rs | 10 ++--- src/commands/take.rs | 10 ++--- src/commands/to_array.rs | 12 ++---- src/context.rs | 11 +----- src/errors.rs | 2 + src/format.rs | 12 ++++-- src/format/entries.rs | 2 +- src/format/list.rs | 3 +- src/format/table.rs | 2 +- src/main.rs | 25 +++---------- src/object.rs | 1 - src/object/base.rs | 32 ++++++---------- src/object/desc.rs | 18 +-------- src/object/dict.rs | 9 ++--- src/object/files.rs | 8 +--- src/object/process.rs | 10 +---- src/object/types.rs | 2 +- src/parser/completer.rs | 7 ++-- src/parser/parse.rs | 6 +-- src/prelude.rs | 4 +- 26 files changed, 77 insertions(+), 231 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index e7550af4e..4f4fb02ed 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -8,5 +8,4 @@ crate mod select; crate mod take; crate mod to_array; -crate use command::Command; crate use to_array::to_array; diff --git a/src/commands/args.rs b/src/commands/args.rs index 671567bb1..9c2d1f695 100644 --- a/src/commands/args.rs +++ b/src/commands/args.rs @@ -1,9 +1,6 @@ use crate::object::Value; -use crate::ShellError; -use derive_new::new; -use std::cell::Cell; -use std::collections::VecDeque; +#[allow(unused)] #[derive(Debug)] pub enum LogLevel { Trace, @@ -14,81 +11,9 @@ pub enum LogLevel { Fatal, } +#[allow(unused)] #[derive(Debug)] pub struct LogItem { level: LogLevel, value: Value, } - -#[derive(Debug, Default)] -pub struct ObjectStream { - queue: VecDeque, -} - -impl ObjectStream { - crate fn empty() -> ObjectStream { - ObjectStream { - queue: VecDeque::new(), - } - } - - crate fn iter(&self) -> impl Iterator { - self.queue.iter() - } - - crate fn take(&mut self) -> Option { - self.queue.pop_front() - } - - crate fn add(&mut self, value: T) { - self.queue.push_back(value); - } -} - -#[derive(new)] -pub struct Streams { - #[new(value = "ObjectStream::empty()")] - success: ObjectStream, - - #[new(value = "ObjectStream::empty()")] - errors: ObjectStream, - - #[new(value = "ObjectStream::empty()")] - log: ObjectStream, -} - -impl std::fmt::Debug for Streams { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(f, "Streams") - } -} - -impl Streams { - crate fn read(&mut self) -> Option { - self.success.take() - } - - crate fn add(&mut self, value: Value) { - self.success.add(value); - } - - // fn take_stream(&mut self, stream: &mut ObjectStream) -> ObjectStream { - // let mut new_stream = Cell::new(ObjectStream::default()); - // new_stream.swap() - // std::mem::swap(stream, &mut new_stream); - // new_stream - // } -} - -#[derive(Debug, new)] -pub struct Args { - argv: Vec, - #[new(value = "Streams::new()")] - streams: Streams, -} - -impl Args { - crate fn first(&self) -> Option<&Value> { - self.argv.first() - } -} diff --git a/src/commands/cd.rs b/src/commands/cd.rs index faab467ed..d7104f388 100644 --- a/src/commands/cd.rs +++ b/src/commands/cd.rs @@ -1,11 +1,8 @@ use crate::errors::ShellError; -use crate::object::process::Process; -use crate::object::{dir_entry_dict, Value}; +use crate::object::Value; use crate::prelude::*; -use crate::Args; use derive_new::new; -use std::path::{Path, PathBuf}; -use sysinfo::SystemExt; +use std::path::PathBuf; #[derive(new)] pub struct CdBlueprint; @@ -14,7 +11,7 @@ impl crate::CommandBlueprint for CdBlueprint { fn create( &self, args: Vec, - host: &dyn Host, + _host: &dyn Host, env: &mut Environment, ) -> Result, ShellError> { let target = match args.first() { @@ -37,7 +34,7 @@ pub struct Cd { } impl crate::Command for Cd { - fn run(&mut self, stream: VecDeque) -> Result, ShellError> { + fn run(&mut self, _stream: VecDeque) -> Result, ShellError> { let mut stream = VecDeque::new(); let path = dunce::canonicalize(self.cwd.join(&self.target).as_path())?; stream.push_back(ReturnValue::change_cwd(path)); diff --git a/src/commands/ls.rs b/src/commands/ls.rs index 8cc59a5f3..29f089cd6 100644 --- a/src/commands/ls.rs +++ b/src/commands/ls.rs @@ -1,12 +1,9 @@ use crate::errors::ShellError; -use crate::object::process::Process; use crate::object::{dir_entry_dict, Value}; use crate::prelude::*; -use crate::Args; use crate::Command; use derive_new::new; use std::path::PathBuf; -use sysinfo::SystemExt; #[derive(new)] pub struct LsBlueprint; @@ -14,8 +11,8 @@ pub struct LsBlueprint; impl crate::CommandBlueprint for LsBlueprint { fn create( &self, - args: Vec, - host: &dyn crate::Host, + _args: Vec, + _host: &dyn crate::Host, env: &mut crate::Environment, ) -> Result, ShellError> { Ok(Box::new(Ls { @@ -30,9 +27,9 @@ pub struct Ls { } impl crate::Command for Ls { - fn run(&mut self, stream: VecDeque) -> Result, ShellError> { + fn run(&mut self, _stream: VecDeque) -> Result, ShellError> { let entries = - std::fs::read_dir(&self.cwd).map_err((|e| ShellError::string(format!("{:?}", e))))?; + std::fs::read_dir(&self.cwd).map_err(|e| ShellError::string(format!("{:?}", e)))?; let mut shell_entries = VecDeque::new(); diff --git a/src/commands/ps.rs b/src/commands/ps.rs index 0504aefae..cb4ea3b6a 100644 --- a/src/commands/ps.rs +++ b/src/commands/ps.rs @@ -4,8 +4,6 @@ use crate::object::Value; use crate::prelude::*; use crate::Command; use derive_new::new; -use std::cell::RefCell; -use std::rc::Rc; use sysinfo::SystemExt; #[derive(new)] @@ -14,9 +12,9 @@ pub struct PsBlueprint; impl crate::CommandBlueprint for PsBlueprint { fn create( &self, - args: Vec, - host: &dyn crate::Host, - env: &mut crate::Environment, + _args: Vec, + _host: &dyn crate::Host, + _env: &mut crate::Environment, ) -> Result, ShellError> { Ok(Box::new(Ps::new())) } @@ -26,7 +24,7 @@ impl crate::CommandBlueprint for PsBlueprint { pub struct Ps; impl crate::Command for Ps { - fn run(&mut self, stream: VecDeque) -> Result, ShellError> { + fn run(&mut self, _stream: VecDeque) -> Result, ShellError> { let mut system = sysinfo::System::new(); system.refresh_all(); diff --git a/src/commands/reject.rs b/src/commands/reject.rs index fa394f93d..057ccd5cf 100644 --- a/src/commands/reject.rs +++ b/src/commands/reject.rs @@ -1,12 +1,8 @@ use crate::errors::ShellError; use crate::object::base::reject; -use crate::object::process::Process; -use crate::object::{dir_entry_dict, Value}; +use crate::object::Value; use crate::prelude::*; -use crate::Args; use derive_new::new; -use std::path::{Path, PathBuf}; -use sysinfo::SystemExt; #[derive(new)] pub struct RejectBlueprint; @@ -15,8 +11,8 @@ impl crate::CommandBlueprint for RejectBlueprint { fn create( &self, args: Vec, - host: &dyn Host, - env: &mut Environment, + _host: &dyn Host, + _env: &mut Environment, ) -> Result, ShellError> { if args.is_empty() { return Err(ShellError::string("take requires an integer")); diff --git a/src/commands/select.rs b/src/commands/select.rs index 37a2b2b0a..8f890d827 100644 --- a/src/commands/select.rs +++ b/src/commands/select.rs @@ -1,12 +1,8 @@ use crate::errors::ShellError; use crate::object::base::select; -use crate::object::process::Process; -use crate::object::{dir_entry_dict, Value}; +use crate::object::Value; use crate::prelude::*; -use crate::Args; use derive_new::new; -use std::path::{Path, PathBuf}; -use sysinfo::SystemExt; #[derive(new)] pub struct SelectBlueprint; @@ -15,8 +11,8 @@ impl crate::CommandBlueprint for SelectBlueprint { fn create( &self, args: Vec, - host: &dyn Host, - env: &mut Environment, + _host: &dyn Host, + _env: &mut Environment, ) -> Result, ShellError> { if args.is_empty() { return Err(ShellError::string("take requires an integer")); diff --git a/src/commands/take.rs b/src/commands/take.rs index 014f73ce5..64a95486e 100644 --- a/src/commands/take.rs +++ b/src/commands/take.rs @@ -1,11 +1,7 @@ use crate::errors::ShellError; -use crate::object::process::Process; -use crate::object::{dir_entry_dict, Value}; +use crate::object::Value; use crate::prelude::*; -use crate::Args; use derive_new::new; -use std::path::{Path, PathBuf}; -use sysinfo::SystemExt; #[derive(new)] pub struct TakeBlueprint; @@ -14,8 +10,8 @@ impl crate::CommandBlueprint for TakeBlueprint { fn create( &self, args: Vec, - host: &dyn Host, - env: &mut Environment, + _host: &dyn Host, + _env: &mut Environment, ) -> Result, ShellError> { if args.is_empty() { return Err(ShellError::string("take requires an integer")); diff --git a/src/commands/to_array.rs b/src/commands/to_array.rs index 852af14a9..feb01e62f 100644 --- a/src/commands/to_array.rs +++ b/src/commands/to_array.rs @@ -1,11 +1,7 @@ use crate::errors::ShellError; -use crate::object::process::Process; -use crate::object::{dir_entry_dict, Value}; +use crate::object::Value; use crate::prelude::*; -use crate::Args; use derive_new::new; -use std::path::{Path, PathBuf}; -use sysinfo::SystemExt; #[derive(new)] pub struct ToArrayBlueprint; @@ -13,9 +9,9 @@ pub struct ToArrayBlueprint; impl crate::CommandBlueprint for ToArrayBlueprint { fn create( &self, - args: Vec, - host: &dyn Host, - env: &mut Environment, + _args: Vec, + _host: &dyn Host, + _env: &mut Environment, ) -> Result, ShellError> { Ok(Box::new(ToArray)) } diff --git a/src/context.rs b/src/context.rs index 9bafe5c0e..b420b05d5 100644 --- a/src/context.rs +++ b/src/context.rs @@ -1,11 +1,8 @@ use crate::prelude::*; -use std::collections::BTreeMap; use std::error::Error; -pub type Commands = BTreeMap>; - pub struct Context { - commands: BTreeMap>, + commands: indexmap::IndexMap>, crate host: Box, crate env: Environment, } @@ -13,7 +10,7 @@ pub struct Context { impl Context { crate fn basic() -> Result> { Ok(Context { - commands: BTreeMap::new(), + commands: indexmap::IndexMap::new(), host: Box::new(crate::env::host::BasicHost), env: crate::Environment::basic()?, }) @@ -25,10 +22,6 @@ impl Context { } } - crate fn get_command(&mut self, name: &str) -> Option<&dyn crate::CommandBlueprint> { - self.commands.get(name).map(|c| &**c) - } - crate fn has_command(&mut self, name: &str) -> bool { self.commands.contains_key(name) } diff --git a/src/errors.rs b/src/errors.rs index a8ce1de7f..b4cc52023 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,4 +1,6 @@ +#[allow(unused)] use crate::prelude::*; + use crate::Value; use derive_new::new; diff --git a/src/format.rs b/src/format.rs index a946833bc..10c5ff04c 100644 --- a/src/format.rs +++ b/src/format.rs @@ -3,20 +3,26 @@ crate mod generic; crate mod list; crate mod table; -use crate::object::Value; use crate::prelude::*; +use crate::Context; +use std::sync::{Arc, Mutex}; + crate use entries::{EntriesListView, EntriesView}; crate use generic::GenericView; -crate use list::ListView; crate use table::TableView; crate trait RenderView { fn render_view(&self, host: &dyn Host) -> Vec; } -crate fn print_rendered(lines: &[String], host: &mut dyn Host) { +fn print_rendered(lines: &[String], host: &mut dyn Host) { for line in lines { host.stdout(line); } } + +crate fn print_view(view: &impl RenderView, context: Arc>) { + let mut ctx = context.lock().unwrap(); + crate::format::print_rendered(&view.render_view(&ctx.host), &mut ctx.host); +} diff --git a/src/format/entries.rs b/src/format/entries.rs index 1f6e22379..5b7c87e83 100644 --- a/src/format/entries.rs +++ b/src/format/entries.rs @@ -32,7 +32,7 @@ impl EntriesView { } impl RenderView for EntriesView { - fn render_view(&self, host: &dyn Host) -> Vec { + fn render_view(&self, _host: &dyn Host) -> Vec { if self.entries.len() == 0 { return vec![]; } diff --git a/src/format/list.rs b/src/format/list.rs index 53fe04ce8..ad423c0ad 100644 --- a/src/format/list.rs +++ b/src/format/list.rs @@ -3,6 +3,7 @@ use crate::Host; use derive_new::new; // A list is printed one line at a time with an optional separator between groups +#[allow(unused)] #[derive(new)] pub struct ListView { list: Vec>, @@ -10,7 +11,7 @@ pub struct ListView { } impl RenderView for ListView { - fn render_view(&self, host: &dyn Host) -> Vec { + fn render_view(&self, _host: &dyn Host) -> Vec { let mut out = vec![]; for output in &self.list { diff --git a/src/format/table.rs b/src/format/table.rs index c388f3545..02d463a29 100644 --- a/src/format/table.rs +++ b/src/format/table.rs @@ -43,7 +43,7 @@ impl TableView { } impl RenderView for TableView { - fn render_view(&self, host: &dyn Host) -> Vec { + fn render_view(&self, _host: &dyn Host) -> Vec { if self.entries.len() == 0 { return vec![]; } diff --git a/src/main.rs b/src/main.rs index bd9efcca1..7c8316ce0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,5 @@ #![feature(crate_visibility_modifier)] #![feature(in_band_lifetimes)] -#![allow(unused)] mod commands; mod context; @@ -11,28 +10,21 @@ mod object; mod parser; mod prelude; -crate use crate::commands::args::{Args, Streams}; use crate::commands::command::ReturnValue; crate use crate::commands::command::{Command, CommandAction, CommandBlueprint}; use crate::context::Context; crate use crate::env::{Environment, Host}; crate use crate::errors::ShellError; -crate use crate::format::{EntriesListView, GenericView, RenderView}; +crate use crate::format::{EntriesListView, GenericView}; use crate::object::Value; use ansi_term::Color; -use conch_parser::lexer::Lexer; -use conch_parser::parse::DefaultParser; use rustyline::error::ReadlineError; use rustyline::Editor; -use std::cell::RefCell; -use std::collections::BTreeMap; use std::collections::VecDeque; use std::error::Error; -use std::rc::Rc; use std::sync::{Arc, Mutex}; use subprocess::Exec; -use sysinfo::{self, SystemExt}; #[derive(Debug)] pub enum MaybeOwned<'a, T> { @@ -55,7 +47,7 @@ fn main() -> Result<(), Box> { println!("No previous history."); } - let mut context = Arc::new(Mutex::new(Context::basic()?)); + let context = Arc::new(Mutex::new(Context::basic()?)); { use crate::commands::*; @@ -88,8 +80,6 @@ fn main() -> Result<(), Box> { let mut input = VecDeque::new(); - let last = parsed.len() - 1; - for item in parsed { input = process_command( crate::parser::print_items(&item), @@ -135,17 +125,14 @@ fn process_command( let command = &parsed[0].name(); let arg_list = parsed[1..].iter().map(|i| i.as_value()).collect(); - let streams = Streams::new(); - if command == &"format" { format(input, context); Ok(VecDeque::new()) } else if command == &"format-list" { let view = EntriesListView::from_stream(input); - let mut ctx = context.lock().unwrap(); - crate::format::print_rendered(&view.render_view(&ctx.host), &mut ctx.host); + crate::format::print_view(&view, context.clone()); Ok(VecDeque::new()) } else { @@ -155,7 +142,7 @@ fn process_command( true => { let mut instance = ctx.create_command(command, arg_list)?; - let mut result = instance.run(input)?; + let result = instance.run(input)?; let mut next = VecDeque::new(); for v in result { @@ -180,12 +167,10 @@ fn process_command( } fn format(input: VecDeque, context: Arc>) { - let mut ctx = context.lock().unwrap(); - let last = input.len() - 1; for (i, item) in input.iter().enumerate() { let view = GenericView::new(item); - crate::format::print_rendered(&view.render_view(&ctx.host), &mut ctx.host); + crate::format::print_view(&view, context.clone()); if last != i { println!(""); diff --git a/src/object.rs b/src/object.rs index be6337be4..fc01dc2bc 100644 --- a/src/object.rs +++ b/src/object.rs @@ -6,6 +6,5 @@ crate mod process; crate mod types; crate use base::{Primitive, Value}; -crate use desc::{DataDescriptor, DataDescriptorInstance}; crate use dict::Dictionary; crate use files::dir_entry_dict; diff --git a/src/object/base.rs b/src/object/base.rs index 597f865fb..676d35f29 100644 --- a/src/object/base.rs +++ b/src/object/base.rs @@ -1,16 +1,15 @@ use crate::errors::ShellError; -use crate::format::{EntriesView, GenericView}; use crate::object::desc::DataDescriptor; use ansi_term::Color; use chrono::{DateTime, Utc}; use chrono_humanize::Humanize; -use std::fmt::Debug; use std::time::SystemTime; #[derive(Debug, Clone)] pub enum Primitive { Nothing, Int(i64), + #[allow(unused)] Float(f64), Bytes(u128), String(String), @@ -43,7 +42,7 @@ impl Primitive { (true, None) => format!("Yes"), (false, None) => format!("No"), (true, Some(s)) => format!("{}", s), - (false, Some(s)) => format!(""), + (false, Some(_)) => format!(""), }, Primitive::Date(d) => format!("{}", d.humanize()), } @@ -59,30 +58,21 @@ pub enum Value { } impl Value { - crate fn to_shell_string(&self) -> String { - match self { - Value::Primitive(p) => p.format(None), - Value::Object(o) => format!("[object Object]"), - Value::List(l) => format!("[list List]"), - Value::Error(e) => format!("{}", e), - } - } - crate fn data_descriptors(&self) -> Vec { match self { - Value::Primitive(p) => vec![], + Value::Primitive(_) => vec![], Value::Object(o) => o.data_descriptors(), - Value::List(l) => vec![], - Value::Error(e) => vec![], + Value::List(_) => vec![], + Value::Error(_) => vec![], } } crate fn get_data(&'a self, desc: &DataDescriptor) -> crate::MaybeOwned<'a, Value> { match self { - Value::Primitive(p) => crate::MaybeOwned::Owned(Value::nothing()), + Value::Primitive(_) => crate::MaybeOwned::Owned(Value::nothing()), Value::Object(o) => o.get_data(desc), - Value::List(l) => crate::MaybeOwned::Owned(Value::nothing()), - Value::Error(e) => crate::MaybeOwned::Owned(Value::nothing()), + Value::List(_) => crate::MaybeOwned::Owned(Value::nothing()), + Value::Error(_) => crate::MaybeOwned::Owned(Value::nothing()), } } @@ -101,8 +91,8 @@ impl Value { crate fn format_leaf(&self, field_name: Option<&str>) -> String { match self { Value::Primitive(p) => p.format(field_name), - Value::Object(o) => format!("[object Object]"), - Value::List(l) => format!("[list List]"), + Value::Object(_) => format!("[object Object]"), + Value::List(_) => format!("[list List]"), Value::Error(e) => format!("{}", e), } } @@ -142,6 +132,7 @@ impl Value { Value::Primitive(Primitive::Int(s.into())) } + #[allow(unused)] crate fn system_date(s: SystemTime) -> Value { Value::Primitive(Primitive::Date(s.into())) } @@ -161,6 +152,7 @@ impl Value { Value::Primitive(Primitive::Nothing) } + #[allow(unused)] crate fn list(values: impl Into>) -> Value { Value::List(values.into()) } diff --git a/src/object/desc.rs b/src/object/desc.rs index 0bce4103a..21c11c874 100644 --- a/src/object/desc.rs +++ b/src/object/desc.rs @@ -1,4 +1,4 @@ -use crate::object::types::{AnyShell, Type}; +use crate::object::types::Type; use derive_new::new; #[derive(new)] @@ -14,18 +14,4 @@ impl PartialEq for DataDescriptor { } } -impl DataDescriptor { - crate fn any(name: impl Into) -> DataDescriptor { - DataDescriptor { - name: name.into(), - readonly: true, - ty: Box::new(AnyShell), - } - } -} - -#[derive(new)] -pub struct DataDescriptorInstance<'desc> { - desc: &'desc DataDescriptor, - value: crate::object::base::Value, -} +impl DataDescriptor {} diff --git a/src/object/dict.rs b/src/object/dict.rs index 98e315ca5..c79c08ecb 100644 --- a/src/object/dict.rs +++ b/src/object/dict.rs @@ -1,11 +1,10 @@ +#[allow(unused)] +use crate::prelude::*; + use crate::object::desc::DataDescriptor; use crate::object::{Primitive, Value}; -use crate::prelude::*; use crate::MaybeOwned; -use derive_new::new; use indexmap::IndexMap; -use std::cell::RefCell; -use std::rc::Rc; #[derive(Debug, Default)] pub struct Dictionary { @@ -30,7 +29,7 @@ impl Dictionary { crate fn data_descriptors(&self) -> Vec { self.entries .iter() - .map(|(name, value)| { + .map(|(name, _)| { DataDescriptor::new(name.clone(), true, Box::new(crate::object::types::AnyShell)) }) .collect() diff --git a/src/object/files.rs b/src/object/files.rs index 45b4086b3..6c07079f7 100644 --- a/src/object/files.rs +++ b/src/object/files.rs @@ -1,11 +1,5 @@ use crate::errors::ShellError; -use crate::object::{DataDescriptor, Dictionary, Value}; -use crate::MaybeOwned; - -#[derive(Debug)] -pub struct DirEntry { - dict: Dictionary, -} +use crate::object::{Dictionary, Value}; #[derive(Debug)] pub enum FileType { diff --git a/src/object/process.rs b/src/object/process.rs index fe63ff540..eeb8d00a7 100644 --- a/src/object/process.rs +++ b/src/object/process.rs @@ -1,16 +1,8 @@ -use crate::object::base::{Primitive, Value}; -use crate::object::desc::DataDescriptor; +use crate::object::base::Value; use crate::object::dict::Dictionary; -use crate::MaybeOwned; -use derive_new::new; use itertools::join; use sysinfo::ProcessExt; -#[derive(Debug)] -pub struct Process { - dict: Dictionary, -} - crate fn process_dict(proc: &sysinfo::Process) -> Dictionary { let mut dict = Dictionary::default(); dict.add("name", Value::string(proc.name())); diff --git a/src/object/types.rs b/src/object/types.rs index 8ff2678ec..367334666 100644 --- a/src/object/types.rs +++ b/src/object/types.rs @@ -1,4 +1,4 @@ -use std::any::{Any, TypeId}; +use std::any::Any; pub trait Type { fn as_any(&self) -> &dyn Any; diff --git a/src/parser/completer.rs b/src/parser/completer.rs index 09d3162ab..8591475e6 100644 --- a/src/parser/completer.rs +++ b/src/parser/completer.rs @@ -1,6 +1,7 @@ use rustyline::{completion, Context}; use std::collections::BTreeMap; +#[allow(unused)] crate struct Completer { commands: BTreeMap>, } @@ -10,9 +11,9 @@ impl completion::Completer for Completer { fn complete( &self, - line: &str, - pos: usize, - ctx: &Context<'_>, + _line: &str, + _pos: usize, + _ctx: &Context<'_>, ) -> rustyline::Result<(usize, Vec)> { let pairs = self .commands diff --git a/src/parser/parse.rs b/src/parser/parse.rs index 75bddf88e..b2c68a899 100644 --- a/src/parser/parse.rs +++ b/src/parser/parse.rs @@ -5,7 +5,7 @@ use nom::character::complete::one_of; use nom::multi::separated_list; use nom::sequence::{preceded, terminated}; use nom::IResult; -use nom::{complete, named, separated_list, ws}; +use nom::{complete, named, ws}; use std::str::FromStr; #[derive(Debug, Clone)] @@ -26,8 +26,6 @@ impl Item { } crate fn print_items(items: &[Item]) -> String { - let mut out = String::new(); - let formatted = items.iter().map(|item| match item { Item::Bare(s) => format!("{}", s), Item::Quoted(s) => format!("{:?}", s), @@ -42,7 +40,7 @@ impl Item { match self { Item::Quoted(s) => s, Item::Bare(s) => s, - Item::Int(i) => unimplemented!(), + Item::Int(_) => unimplemented!(), } } } diff --git a/src/prelude.rs b/src/prelude.rs index ec0a5a153..f115ad8d8 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,7 +1,5 @@ -crate use crate::commands::args::{Args, Streams}; -crate use crate::commands::command::{Command, CommandAction, CommandBlueprint, ReturnValue}; +crate use crate::commands::command::{Command, ReturnValue}; crate use crate::env::{Environment, Host}; crate use crate::errors::ShellError; -crate use crate::format::RenderView; crate use crate::object::{Primitive, Value}; crate use std::collections::VecDeque;