mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 22:47:43 +02:00
Refactor: introduce 2 associated functions to PipelineData
(#16233)
# Description As title: this pr is try to introduce 2 functions to `PipelineData`: 1. PipelineData::list_stream --> create a PipelineData::ListStream 2. PipelineData::byte_stream -> create a PipelineData::ByteStream And use these functions everywhere. ### Reason behind this change I tried to implement `pipefail` feature, but this would required to change `PipelineData` from enum to struct. So use these functions can reduce diff if I finally change to struct. [Discord message here](https://discord.com/channels/601130461678272522/615962413203718156/1396999539000479784) is my plan. # User-Facing Changes NaN # Tests + Formatting NaN # After Submitting NaN
This commit is contained in:
@ -278,7 +278,7 @@ pub fn migrate_old_plugin_file(engine_state: &EngineState) -> bool {
|
||||
&mut stack,
|
||||
&old_contents,
|
||||
&old_plugin_file_path.to_string_lossy(),
|
||||
PipelineData::Empty,
|
||||
PipelineData::empty(),
|
||||
false,
|
||||
) != 0
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ fn get_prompt_string(
|
||||
.and_then(|v| match v {
|
||||
Value::Closure { val, .. } => {
|
||||
let result = ClosureEvalOnce::new(engine_state, stack, val.as_ref().clone())
|
||||
.run_with_input(PipelineData::Empty);
|
||||
.run_with_input(PipelineData::empty());
|
||||
|
||||
trace!(
|
||||
"get_prompt_string (block) {}:{}:{}",
|
||||
@ -76,7 +76,7 @@ fn get_prompt_string(
|
||||
})
|
||||
.ok()
|
||||
}
|
||||
Value::String { .. } => Some(PipelineData::Value(v.clone(), None)),
|
||||
Value::String { .. } => Some(PipelineData::value(v.clone(), None)),
|
||||
_ => None,
|
||||
})
|
||||
.and_then(|pipeline_data| {
|
||||
|
@ -159,7 +159,7 @@ pub(crate) fn add_menus(
|
||||
engine_state.merge_delta(delta)?;
|
||||
|
||||
let mut temp_stack = Stack::new().collect_value();
|
||||
let input = PipelineData::Empty;
|
||||
let input = PipelineData::empty();
|
||||
menu_eval_results.push(eval_block::<WithoutDebug>(
|
||||
&engine_state,
|
||||
&mut temp_stack,
|
||||
|
@ -2140,7 +2140,8 @@ fn run_external_completion_within_pwd(
|
||||
assert!(engine_state.merge_delta(delta).is_ok());
|
||||
|
||||
assert!(
|
||||
eval_block::<WithoutDebug>(&engine_state, &mut stack, &block, PipelineData::Empty).is_ok()
|
||||
eval_block::<WithoutDebug>(&engine_state, &mut stack, &block, PipelineData::empty())
|
||||
.is_ok()
|
||||
);
|
||||
|
||||
// Merge environment into the permanent state
|
||||
|
@ -199,7 +199,7 @@ pub fn merge_input(
|
||||
engine_state,
|
||||
stack,
|
||||
&block,
|
||||
PipelineData::Value(Value::nothing(Span::unknown()), None),
|
||||
PipelineData::value(Value::nothing(Span::unknown()), None),
|
||||
)
|
||||
.is_ok()
|
||||
);
|
||||
|
Reference in New Issue
Block a user