mirror of
https://github.com/nushell/nushell.git
synced 2025-07-03 16:13:20 +02:00
Replace &Span
with Span
since Span
is Copy
(#9770)
# Description `Span` is `Copy`, so we probably should not be passing references of `Span` around. This PR replaces all instances of `&Span` with `Span`, copying spans where necessary. # User-Facing Changes This alters some public functions to take `Span` instead of `&Span` as input. Namely, `EngineState::get_span_contents`, `nu_protocol::extract_value`, a bunch of the math commands, and `Gstat::gstat`.
This commit is contained in:
@ -70,10 +70,10 @@ pub fn get_pipeline_elements(
|
||||
while i < pipeline.elements.len() {
|
||||
let pipeline_element = &pipeline.elements[i];
|
||||
let pipeline_expression = pipeline_element.expression().clone();
|
||||
let pipeline_span = &pipeline_element.span();
|
||||
let pipeline_span = pipeline_element.span();
|
||||
let element_str =
|
||||
String::from_utf8_lossy(engine_state.get_span_contents(pipeline_span));
|
||||
let value = Value::string(element_str.to_string(), *pipeline_span);
|
||||
let value = Value::string(element_str.to_string(), pipeline_span);
|
||||
let expr = pipeline_expression.expr.clone();
|
||||
let (command_name, command_args_value) = if let Expr::Call(call) = expr {
|
||||
let command = engine_state.get_decl(call.decl_id);
|
||||
|
Reference in New Issue
Block a user