From df2f3d25b005682fe8e80eba3d55e54ade0fc930 Mon Sep 17 00:00:00 2001 From: ccde177b5fb9b8c55078417b4c9fee Date: Thu, 22 Apr 2021 20:14:20 +0300 Subject: [PATCH] ichwh removed (#3349) * ichwh removed * removed unnecessary into() on PathBuf --- Cargo.toml | 2 -- crates/nu-cli/Cargo.toml | 1 - crates/nu-command/Cargo.toml | 3 +-- crates/nu-command/src/commands/version.rs | 5 ---- crates/nu-command/src/commands/which_.rs | 28 ++++++++++------------- 5 files changed, 13 insertions(+), 26 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4d67c3514..07cb2b53c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,9 +82,7 @@ rustyline-support = ["nu-cli/rustyline-support", "nu-command/rustyline-support"] term-support = ["nu-cli/term", "nu-command/term"] uuid-support = ["nu-cli/uuid_crate", "nu-command/uuid_crate"] which-support = [ - "nu-cli/ichwh", "nu-cli/which", - "nu-command/ichwh", "nu-command/which", "nu-engine/which", ] diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml index 1038636ad..ed37b0dc3 100644 --- a/crates/nu-cli/Cargo.toml +++ b/crates/nu-cli/Cargo.toml @@ -57,7 +57,6 @@ getset = "0.1.1" glob = "0.3.0" htmlescape = "0.3.1" ical = "0.7.0" -ichwh = { version = "0.3.4", optional = true } indexmap = { version = "1.6.1", features = ["serde-1"] } itertools = "0.10.0" lazy_static = "1.*" diff --git a/crates/nu-command/Cargo.toml b/crates/nu-command/Cargo.toml index 351a8a919..7a81875c5 100644 --- a/crates/nu-command/Cargo.toml +++ b/crates/nu-command/Cargo.toml @@ -53,7 +53,6 @@ getset = "0.1.1" glob = "0.3.0" htmlescape = "0.3.1" ical = "0.7.0" -ichwh = { version = "0.3.4", optional = true } indexmap = { version = "1.6.1", features = ["serde-1"] } itertools = "0.10.0" lazy_static = "1.*" @@ -97,7 +96,7 @@ trash = { version = "1.3.0", optional = true } unicode-segmentation = "1.7.1" url = "2.2.0" uuid_crate = { package = "uuid", version = "0.8.2", features = ["v4"], optional = true } -which = { version = "4.0.2", optional = true } +which = { version = "4.1.0", optional = true } zip = { version = "0.5.9", optional = true } [target.'cfg(unix)'.dependencies] diff --git a/crates/nu-command/src/commands/version.rs b/crates/nu-command/src/commands/version.rs index 4aadc3cbc..f7b668d04 100644 --- a/crates/nu-command/src/commands/version.rs +++ b/crates/nu-command/src/commands/version.rs @@ -192,11 +192,6 @@ fn features_enabled() -> Vec { names.push("which".to_string()); } - #[cfg(feature = "ichwh")] - { - names.push("ichwh".to_string()); - } - #[cfg(feature = "zip")] { names.push("zip".to_string()); diff --git a/crates/nu-command/src/commands/which_.rs b/crates/nu-command/src/commands/which_.rs index d13cac8c6..ebb3c9aff 100644 --- a/crates/nu-command/src/commands/which_.rs +++ b/crates/nu-command/src/commands/which_.rs @@ -135,32 +135,28 @@ macro_rules! entry_path { }; } -#[cfg(feature = "ichwh")] +#[cfg(feature = "which")] fn get_first_entry_in_path(item: &str, tag: Tag) -> Option { - use futures::executor::block_on; - - block_on(ichwh::which(item)) - .unwrap_or(None) - .map(|path| entry_path!(item, path.into(), tag)) + which::which(item) + .map(|path| entry_path!(item, path, tag)) + .ok() } -#[cfg(not(feature = "ichwh"))] +#[cfg(not(feature = "which"))] fn get_first_entry_in_path(_: &str, _: Tag) -> Option { None } -#[cfg(feature = "ichwh")] +#[cfg(feature = "which")] fn get_all_entries_in_path(item: &str, tag: Tag) -> Vec { - use futures::executor::block_on; - - block_on(ichwh::which_all(&item)) + which::which_all(&item) + .map(|iter| { + iter.map(|path| entry_path!(item, path, tag.clone())) + .collect() + }) .unwrap_or_default() - .into_iter() - .map(|path| entry_path!(item, path.into(), tag.clone())) - .collect() } - -#[cfg(not(feature = "ichwh"))] +#[cfg(not(feature = "which"))] fn get_all_entries_in_path(_: &str, _: Tag) -> Vec { vec![] }