Fix issue in external subexpression paths (#3642)

* Fix issue in external subexpression paths

* new clippy dropped

* clippy
This commit is contained in:
JT
2021-06-18 07:59:58 +12:00
committed by GitHub
parent 6c2c16a971
commit d9d956e54f
159 changed files with 285 additions and 324 deletions

View File

@@ -164,17 +164,16 @@ impl From<Vec<Value>> for InputStream {
}
}
#[allow(clippy::clippy::wrong_self_convention)]
pub trait ToInputStream {
fn to_input_stream(self) -> InputStream;
pub trait IntoInputStream {
fn into_input_stream(self) -> InputStream;
}
impl<T, U> ToInputStream for T
impl<T, U> IntoInputStream for T
where
T: Iterator<Item = U> + Send + Sync + 'static,
U: Into<Result<nu_protocol::Value, nu_errors::ShellError>>,
{
fn to_input_stream(self) -> InputStream {
fn into_input_stream(self) -> InputStream {
InputStream {
empty: false,
values: Box::new(self.map(|item| match item.into() {

View File

@@ -7,5 +7,5 @@ mod output;
pub use input::*;
pub use interruptible::*;
pub use output::*;
pub use prelude::ToActionStream;
pub use prelude::ToOutputStream;
pub use prelude::IntoActionStream;
pub use prelude::IntoOutputStream;

View File

@@ -38,31 +38,29 @@ use nu_protocol::Value;
pub(crate) use crate::{ActionStream, InputStream, OutputStream};
#[allow(clippy::wrong_self_convention)]
pub trait ToOutputStream {
fn to_output_stream(self) -> OutputStream;
pub trait IntoOutputStream {
fn into_output_stream(self) -> OutputStream;
}
impl<T> ToOutputStream for T
impl<T> IntoOutputStream for T
where
T: Iterator<Item = Value> + Send + Sync + 'static,
{
fn to_output_stream(self) -> OutputStream {
fn into_output_stream(self) -> OutputStream {
OutputStream::from_stream(self)
}
}
#[allow(clippy::wrong_self_convention)]
pub trait ToActionStream {
fn to_action_stream(self) -> ActionStream;
pub trait IntoActionStream {
fn into_action_stream(self) -> ActionStream;
}
impl<T, U> ToActionStream for T
impl<T, U> IntoActionStream for T
where
T: Iterator<Item = U> + Send + Sync + 'static,
U: Into<nu_protocol::ReturnValue>,
{
fn to_action_stream(self) -> ActionStream {
fn into_action_stream(self) -> ActionStream {
ActionStream {
values: Box::new(self.map(|item| item.into())),
}