Rust 1.85, edition=2024 (#15741)

This commit is contained in:
Jack Wright
2025-05-13 07:49:30 -07:00
committed by GitHub
parent 1a0986903f
commit c2ac8f730e
793 changed files with 4276 additions and 3687 deletions

View File

@ -2,7 +2,7 @@
authors = ["The Nushell Project Developers"]
description = "Nushell's internal protocols, including its abstract syntax tree"
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-protocol"
edition = "2021"
edition = "2024"
license = "MIT"
name = "nu-protocol"
version = "0.104.1"

View File

@ -1,7 +1,7 @@
use crate::{
PipelineData, ShellError, Signature,
ast::Expression,
engine::{Call, Command, CommandType, EngineState, Stack},
PipelineData, ShellError, Signature,
};
/// Command wrapper of an alias.

View File

@ -1,5 +1,5 @@
use super::Pipeline;
use crate::{engine::StateWorkingSet, ir::IrBlock, OutDest, Signature, Span, Type, VarId};
use crate::{OutDest, Signature, Span, Type, VarId, engine::StateWorkingSet, ir::IrBlock};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]

View File

@ -3,8 +3,8 @@ use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use crate::{
ast::Expression, engine::StateWorkingSet, eval_const::eval_constant, DeclId, FromValue,
ShellError, Span, Spanned, Value,
DeclId, FromValue, ShellError, Span, Spanned, Value, ast::Expression, engine::StateWorkingSet,
eval_const::eval_constant,
};
/// Parsed command arguments

View File

@ -60,12 +60,8 @@ impl PathMember {
pub fn make_optional(&mut self) {
match self {
PathMember::String {
ref mut optional, ..
} => *optional = true,
PathMember::Int {
ref mut optional, ..
} => *optional = true,
PathMember::String { optional, .. } => *optional = true,
PathMember::Int { optional, .. } => *optional = true,
}
}

View File

@ -6,7 +6,7 @@ use super::{
MatchPattern, Operator, Range, Table, ValueWithUnit,
};
use crate::{
ast::ImportPattern, engine::StateWorkingSet, BlockId, ModuleId, OutDest, Signature, Span, VarId,
BlockId, ModuleId, OutDest, Signature, Span, VarId, ast::ImportPattern, engine::StateWorkingSet,
};
/// An [`Expression`] AST node

View File

@ -1,7 +1,7 @@
use crate::{
BlockId, DeclId, GetSpan, IN_VARIABLE_ID, Signature, Span, SpanId, Type, VarId,
ast::{Argument, Block, Expr, ExternalArgument, ImportPattern, MatchPattern, RecordItem},
engine::StateWorkingSet,
BlockId, DeclId, GetSpan, Signature, Span, SpanId, Type, VarId, IN_VARIABLE_ID,
};
use serde::{Deserialize, Serialize};
use std::sync::Arc;

View File

@ -1,4 +1,4 @@
use crate::{ast::Expression, engine::StateWorkingSet, OutDest, Span, VarId};
use crate::{OutDest, Span, VarId, ast::Expression, engine::StateWorkingSet};
use serde::{Deserialize, Serialize};
use std::fmt::Display;

View File

@ -1,5 +1,5 @@
use super::{ConfigErrors, ConfigPath, IntoValue, ShellError, UpdateFromValue, Value};
use crate::{self as nu_protocol, engine::EngineState, FromValue};
use crate::{self as nu_protocol, FromValue, engine::EngineState};
use serde::{Deserialize, Serialize};
use std::io::IsTerminal;
@ -136,31 +136,41 @@ mod tests {
.into();
// explicit `True` ignores environment variables
assert!(engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
set_env(&mut engine_state, "clicolor", false);
assert!(engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
set_env(&mut engine_state, "clicolor", true);
assert!(engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
set_env(&mut engine_state, "no_color", true);
assert!(engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
set_env(&mut engine_state, "force_color", true);
assert!(engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
}
#[test]
@ -173,31 +183,41 @@ mod tests {
.into();
// explicit `False` ignores environment variables
assert!(!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
set_env(&mut engine_state, "clicolor", false);
assert!(!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
set_env(&mut engine_state, "clicolor", true);
assert!(!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
set_env(&mut engine_state, "no_color", true);
assert!(!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
set_env(&mut engine_state, "force_color", true);
assert!(!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
}
#[test]
@ -221,29 +241,37 @@ mod tests {
// `clicolor` determines ANSI behavior if no higher-priority variables are set
set_env(&mut engine_state, "clicolor", true);
assert!(engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
set_env(&mut engine_state, "clicolor", false);
assert!(!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
// `no_color` overrides `clicolor` and terminal state
set_env(&mut engine_state, "no_color", true);
assert!(!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
!engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
// `force_color` overrides everything
set_env(&mut engine_state, "force_color", true);
assert!(engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state));
assert!(
engine_state
.get_config()
.use_ansi_coloring
.get(&engine_state)
);
}
}

View File

@ -106,7 +106,7 @@ impl UpdateFromValue for PluginGcConfig {
#[cfg(test)]
mod tests {
use super::*;
use crate::{record, Config, Span};
use crate::{Config, Span, record};
fn test_pair() -> (PluginGcConfigs, Value) {
(

View File

@ -1,4 +1,4 @@
pub(super) use super::{error::ConfigErrors, ConfigPath, UpdateFromValue};
pub use crate::{record, IntoValue, ShellError, Span, Type, Value};
pub(super) use super::{ConfigPath, UpdateFromValue, error::ConfigErrors};
pub use crate::{IntoValue, ShellError, Span, Type, Value, record};
pub use serde::{Deserialize, Serialize};
pub use std::str::FromStr;

View File

@ -1,6 +1,6 @@
use super::{config_update_string_enum, prelude::*};
use crate as nu_protocol;
use crate::{engine::Closure, FromValue};
use crate::{FromValue, engine::Closure};
/// Definition of a parsed keybinding from the config object
#[derive(Clone, Debug, FromValue, IntoValue, Serialize, Deserialize)]
@ -41,14 +41,16 @@ impl FromStr for NuCursorShape {
fn from_str(s: &str) -> Result<NuCursorShape, &'static str> {
match s.to_ascii_lowercase().as_str() {
"line" => Ok(NuCursorShape::Line),
"block" => Ok(NuCursorShape::Block),
"underscore" => Ok(NuCursorShape::Underscore),
"blink_line" => Ok(NuCursorShape::BlinkLine),
"blink_block" => Ok(NuCursorShape::BlinkBlock),
"blink_underscore" => Ok(NuCursorShape::BlinkUnderscore),
"inherit" => Ok(NuCursorShape::Inherit),
_ => Err("'line', 'block', 'underscore', 'blink_line', 'blink_block', 'blink_underscore' or 'inherit'"),
"line" => Ok(NuCursorShape::Line),
"block" => Ok(NuCursorShape::Block),
"underscore" => Ok(NuCursorShape::Underscore),
"blink_line" => Ok(NuCursorShape::BlinkLine),
"blink_block" => Ok(NuCursorShape::BlinkBlock),
"blink_underscore" => Ok(NuCursorShape::BlinkUnderscore),
"inherit" => Ok(NuCursorShape::Inherit),
_ => Err(
"'line', 'block', 'underscore', 'blink_line', 'blink_block', 'blink_underscore' or 'inherit'",
),
}
}
}

View File

@ -46,7 +46,9 @@ impl FromStr for TableMode {
"ascii_rounded" => Ok(Self::AsciiRounded),
"basic_compact" => Ok(Self::BasicCompact),
"single" => Ok(Self::Single),
_ => Err("'basic', 'thin', 'light', 'compact', 'with_love', 'compact_double', 'rounded', 'reinforced', 'heavy', 'none', 'psql', 'markdown', 'dots', 'restructured', 'ascii_rounded', 'basic_compact' or 'single'"),
_ => Err(
"'basic', 'thin', 'light', 'compact', 'with_love', 'compact_double', 'rounded', 'reinforced', 'heavy', 'none', 'psql', 'markdown', 'dots', 'restructured', 'ascii_rounded', 'basic_compact' or 'single'",
),
}
}
}

View File

@ -14,10 +14,10 @@
//! `Debugger::report()` to get some output from the debugger, if necessary.
use crate::{
PipelineData, ShellError, Span, Value,
ast::{Block, PipelineElement},
engine::EngineState,
ir::IrBlock,
PipelineData, ShellError, Span, Value,
};
use std::{fmt::Debug, ops::DerefMut};

View File

@ -4,11 +4,12 @@
//! profiling Nushell code.
use crate::{
PipelineData, ShellError, Span, Value,
ast::{Block, Expr, PipelineElement},
debugger::Debugger,
engine::EngineState,
ir::IrBlock,
record, PipelineData, ShellError, Span, Value,
record,
};
use std::{borrow::Borrow, io::BufRead};
use web_time::Instant;

View File

@ -33,18 +33,34 @@ mod tests {
None,
"Not helpful to suggest an arbitrary choice when none are close",
),
("ccccccccccccccccccccccc", None, "Not helpful to suggest an arbitrary choice when none are close"),
(
"ccccccccccccccccccccccc",
None,
"Not helpful to suggest an arbitrary choice when none are close",
),
],
),
(
vec!["OS", "PWD", "PWDPWDPWDPWD"],
vec![
("pwd", Some("PWD"), "Exact case insensitive match yields a match"),
("pwdpwdpwdpwd", Some("PWDPWDPWDPWD"), "Exact case insensitive match yields a match"),
(
"pwd",
Some("PWD"),
"Exact case insensitive match yields a match",
),
(
"pwdpwdpwdpwd",
Some("PWDPWDPWDPWD"),
"Exact case insensitive match yields a match",
),
("PWF", Some("PWD"), "One-letter typo yields a match"),
("pwf", None, "Case difference plus typo yields no match"),
("Xwdpwdpwdpwd", None, "Case difference plus typo yields no match"),
]
(
"Xwdpwdpwdpwd",
None,
"Case difference plus typo yields no match",
),
],
),
(
vec!["foo", "bar", "baz"],
@ -67,11 +83,27 @@ mod tests {
(
vec!["aaaaaa"],
vec![
("XXaaaa", Some("aaaaaa"), "Distance of 2 out of 6 chars: close enough to meet rustc's rule"),
("XXXaaa", None, "Distance of 3 out of 6 chars: not close enough to meet rustc's rule"),
("XaaaaX", Some("aaaaaa"), "Distance of 2 out of 6 chars: close enough to meet rustc's rule"),
("XXaaaaXX", None, "Distance of 4 out of 6 chars: not close enough to meet rustc's rule")
]
(
"XXaaaa",
Some("aaaaaa"),
"Distance of 2 out of 6 chars: close enough to meet rustc's rule",
),
(
"XXXaaa",
None,
"Distance of 3 out of 6 chars: not close enough to meet rustc's rule",
),
(
"XaaaaX",
Some("aaaaaa"),
"Distance of 2 out of 6 chars: close enough to meet rustc's rule",
),
(
"XXaaaaXX",
None,
"Distance of 4 out of 6 chars: not close enough to meet rustc's rule",
),
],
),
];
for (possibilities, cases) in all_cases {

View File

@ -1,6 +1,6 @@
use std::sync::Arc;
use crate::{ast::Expression, ir::DataSlice, Span, Value};
use crate::{Span, Value, ast::Expression, ir::DataSlice};
/// Represents a fully evaluated argument to a call.
#[derive(Debug, Clone)]

View File

@ -1,6 +1,7 @@
use crate::{
DeclId, FromValue, ShellError, Span, Value,
ast::{self, Expression},
ir, DeclId, FromValue, ShellError, Span, Value,
ir,
};
use super::{EngineState, Stack, StateWorkingSet};

View File

@ -1,4 +1,4 @@
use crate::{ast::Call, Span};
use crate::{Span, ast::Call};
#[derive(Debug, Clone)]
pub struct UnevaluatedCallInfo {

View File

@ -1,6 +1,6 @@
use std::borrow::Cow;
use crate::{engine::EngineState, BlockId, ShellError, Span, Value, VarId};
use crate::{BlockId, ShellError, Span, Value, VarId, engine::EngineState};
use serde::{Deserialize, Serialize};

View File

@ -1,6 +1,6 @@
use super::{EngineState, Stack, StateWorkingSet};
use crate::{
engine::Call, Alias, BlockId, Example, OutDest, PipelineData, ShellError, Signature, Value,
Alias, BlockId, Example, OutDest, PipelineData, ShellError, Signature, Value, engine::Call,
};
use std::fmt::Display;

View File

@ -1,16 +1,16 @@
use crate::{
ast::Block,
debugger::{Debugger, NoopDebugger},
engine::{
description::{build_desc, Doccomments},
CachedFile, Command, CommandType, EnvVars, OverlayFrame, ScopeFrame, Stack, StateDelta,
Variable, Visibility, DEFAULT_OVERLAY_NAME,
},
eval_const::create_nu_constant,
shell_error::io::IoError,
BlockId, Category, Config, DeclId, FileId, GetSpan, Handlers, HistoryConfig, JobId, Module,
ModuleId, OverlayId, ShellError, SignalAction, Signals, Signature, Span, SpanId, Type, Value,
VarId, VirtualPathId,
ast::Block,
debugger::{Debugger, NoopDebugger},
engine::{
CachedFile, Command, CommandType, DEFAULT_OVERLAY_NAME, EnvVars, OverlayFrame, ScopeFrame,
Stack, StateDelta, Variable, Visibility,
description::{Doccomments, build_desc},
},
eval_const::create_nu_constant,
shell_error::io::IoError,
};
use fancy_regex::Regex;
use lru::LruCache;
@ -21,10 +21,10 @@ use std::{
num::NonZeroUsize,
path::PathBuf,
sync::{
atomic::{AtomicBool, AtomicU32, Ordering},
mpsc::channel,
mpsc::Sender,
Arc, Mutex, MutexGuard, PoisonError,
atomic::{AtomicBool, AtomicU32, Ordering},
mpsc::Sender,
mpsc::channel,
},
};
@ -1120,7 +1120,7 @@ impl Default for EngineState {
#[cfg(test)]
mod engine_state_tests {
use crate::engine::StateWorkingSet;
use std::str::{from_utf8, Utf8Error};
use std::str::{Utf8Error, from_utf8};
use super::*;
@ -1227,10 +1227,10 @@ mod test_cwd {
//! PWD should NOT point to non-existent entities in the filesystem.
use crate::{
engine::{EngineState, Stack},
Value,
engine::{EngineState, Stack},
};
use nu_path::{assert_path_eq, AbsolutePath, Path};
use nu_path::{AbsolutePath, Path, assert_path_eq};
use tempfile::{NamedTempFile, TempDir};
/// Creates a symlink. Works on both Unix and Windows.

View File

@ -1,15 +1,15 @@
use std::{
collections::{BTreeMap, BTreeSet, HashMap, HashSet},
sync::{
mpsc::{Receiver, RecvTimeoutError, Sender, TryRecvError},
Arc, Mutex,
mpsc::{Receiver, RecvTimeoutError, Sender, TryRecvError},
},
};
#[cfg(not(target_family = "wasm"))]
use std::time::{Duration, Instant};
use nu_system::{kill_by_pid, UnfreezeHandle};
use nu_system::{UnfreezeHandle, kill_by_pid};
use crate::{PipelineData, Signals};

View File

@ -1,6 +1,6 @@
use crate::{
ast::{Expr, MatchPattern, Pattern, RangeInclusion},
Span, Value, VarId,
ast::{Expr, MatchPattern, Pattern, RangeInclusion},
};
pub trait Matcher {

View File

@ -1,9 +1,9 @@
use crate::{
Config, ENV_VARIABLE_ID, IntoValue, NU_VARIABLE_ID, OutDest, ShellError, Span, Value, VarId,
engine::{
ArgumentStack, EngineState, ErrorHandlerStack, Redirection, StackCallArgGuard,
StackCollectValueGuard, StackIoGuard, StackOutDest, DEFAULT_OVERLAY_NAME,
ArgumentStack, DEFAULT_OVERLAY_NAME, EngineState, ErrorHandlerStack, Redirection,
StackCallArgGuard, StackCollectValueGuard, StackIoGuard, StackOutDest,
},
Config, IntoValue, OutDest, ShellError, Span, Value, VarId, ENV_VARIABLE_ID, NU_VARIABLE_ID,
};
use nu_utils::IgnoreCaseExt;
use std::{
@ -774,7 +774,7 @@ impl Stack {
mod test {
use std::sync::Arc;
use crate::{engine::EngineState, Span, Value, VarId};
use crate::{Span, Value, VarId, engine::EngineState};
use super::Stack;

View File

@ -1,4 +1,4 @@
use crate::{engine::Stack, OutDest};
use crate::{OutDest, engine::Stack};
use std::{
fs::File,
mem,

View File

@ -1,10 +1,10 @@
use crate::{
Module, Span,
ast::Block,
engine::{
description::Doccomments, CachedFile, Command, EngineState, OverlayFrame, ScopeFrame,
Variable, VirtualPath,
CachedFile, Command, EngineState, OverlayFrame, ScopeFrame, Variable, VirtualPath,
description::Doccomments,
},
Module, Span,
};
use std::sync::Arc;

View File

@ -1,12 +1,12 @@
use crate::{
ast::Block,
engine::{
description::build_desc, CachedFile, Command, CommandType, EngineState, OverlayFrame,
StateDelta, Variable, VirtualPath, Visibility,
},
BlockId, Category, CompileError, Config, DeclId, FileId, GetSpan, Module, ModuleId, OverlayId,
ParseError, ParseWarning, ResolvedImportPattern, Signature, Span, SpanId, Type, Value, VarId,
VirtualPathId,
ast::Block,
engine::{
CachedFile, Command, CommandType, EngineState, OverlayFrame, StateDelta, Variable,
VirtualPath, Visibility, description::build_desc,
},
};
use core::panic;
use std::{

View File

@ -2,8 +2,8 @@
//!
//! Relies on the `miette` crate for pretty layout
use crate::{
engine::{EngineState, StateWorkingSet},
CompileError, ErrorStyle, ParseError, ParseWarning, ShellError,
engine::{EngineState, StateWorkingSet},
};
use miette::{
LabeledSpan, MietteHandlerOpts, NarratableReportHandler, ReportHandler, RgbColors, Severity,

View File

@ -17,14 +17,18 @@ pub enum CompileError {
#[error("Register {reg_id} was uninitialized when used, possibly reused.")]
#[diagnostic(
code(nu::compile::register_uninitialized),
help("this is a compiler bug. Please report it at https://github.com/nushell/nushell/issues/new\nfrom: {caller}"),
help(
"this is a compiler bug. Please report it at https://github.com/nushell/nushell/issues/new\nfrom: {caller}"
)
)]
RegisterUninitialized { reg_id: RegId, caller: String },
#[error("Register {reg_id} was uninitialized when used, possibly reused.")]
#[diagnostic(
code(nu::compile::register_uninitialized),
help("this is a compiler bug. Please report it at https://github.com/nushell/nushell/issues/new\nfrom: {caller}"),
help(
"this is a compiler bug. Please report it at https://github.com/nushell/nushell/issues/new\nfrom: {caller}"
)
)]
RegisterUninitializedWhilePushingInstruction {
reg_id: RegId,
@ -57,7 +61,9 @@ pub enum CompileError {
#[error("Invalid redirect mode: File should not be specified by commands.")]
#[diagnostic(
code(nu::compile::invalid_redirect_mode),
help("this is a command bug. Please report it at https://github.com/nushell/nushell/issues/new")
help(
"this is a command bug. Please report it at https://github.com/nushell/nushell/issues/new"
)
)]
InvalidRedirectMode {
#[label("while compiling this expression")]
@ -96,7 +102,9 @@ pub enum CompileError {
#[error("Attempted to set branch target of non-branch instruction.")]
#[diagnostic(
code(nu::compile::set_branch_target_of_non_branch_instruction),
help("this is a compiler bug. Please report it at https://github.com/nushell/nushell/issues/new"),
help(
"this is a compiler bug. Please report it at https://github.com/nushell/nushell/issues/new"
)
)]
SetBranchTargetOfNonBranchInstruction {
instruction: String,
@ -218,7 +226,9 @@ pub enum CompileError {
#[error("Incoherent loop state: the loop that ended was not the one we were expecting.")]
#[diagnostic(
code(nu::compile::incoherent_loop_state),
help("this is a compiler bug. Please report it at https://github.com/nushell/nushell/issues/new"),
help(
"this is a compiler bug. Please report it at https://github.com/nushell/nushell/issues/new"
)
)]
IncoherentLoopState {
#[label("while compiling this block")]
@ -228,7 +238,9 @@ pub enum CompileError {
#[error("Undefined label `{label_id}`.")]
#[diagnostic(
code(nu::compile::undefined_label),
help("this is a compiler bug. Please report it at https://github.com/nushell/nushell/issues/new"),
help(
"this is a compiler bug. Please report it at https://github.com/nushell/nushell/issues/new"
)
)]
UndefinedLabel {
label_id: usize,

View File

@ -1,4 +1,4 @@
use super::{shell_error::io::IoError, ShellError};
use super::{ShellError, shell_error::io::IoError};
use crate::Span;
use miette::Diagnostic;
use serde::{Deserialize, Serialize};

View File

@ -1,9 +1,9 @@
use crate::{ast::RedirectionSource, did_you_mean, Span, Type};
use crate::{Span, Type, ast::RedirectionSource, did_you_mean};
use miette::Diagnostic;
use serde::{Deserialize, Serialize};
use std::{
fmt::Display,
str::{from_utf8, Utf8Error},
str::{Utf8Error, from_utf8},
};
use thiserror::Error;
@ -245,14 +245,18 @@ pub enum ParseError {
#[error("Module not found.")]
#[diagnostic(
code(nu::parser::module_not_found),
help("module files and their paths must be available before your script is run as parsing occurs before anything is evaluated")
help(
"module files and their paths must be available before your script is run as parsing occurs before anything is evaluated"
)
)]
ModuleNotFound(#[label = "module {1} not found"] Span, String),
#[error("Missing mod.nu file.")]
#[diagnostic(
code(nu::parser::module_missing_mod_nu_file),
help("Directory {0} is missing a mod.nu file.\n\nWhen importing a directory as a Nushell module, it needs to contain a mod.nu file (can be empty). Alternatively, you can use .nu files in the directory as modules individually.")
help(
"Directory {0} is missing a mod.nu file.\n\nWhen importing a directory as a Nushell module, it needs to contain a mod.nu file (can be empty). Alternatively, you can use .nu files in the directory as modules individually."
)
)]
ModuleMissingModNuFile(
String,
@ -266,7 +270,9 @@ pub enum ParseError {
#[error("Can't export {0} named same as the module.")]
#[diagnostic(
code(nu::parser::named_as_module),
help("Module {1} can't export {0} named the same as the module. Either change the module name, or export `{2}` {0}.")
help(
"Module {1} can't export {0} named the same as the module. Either change the module name, or export `{2}` {0}."
)
)]
NamedAsModule(
String,
@ -288,7 +294,9 @@ pub enum ParseError {
#[error("Can't export alias defined as 'main'.")]
#[diagnostic(
code(nu::parser::export_main_alias_not_allowed),
help("Exporting aliases as 'main' is not allowed. Either rename the alias or convert it to a custom command.")
help(
"Exporting aliases as 'main' is not allowed. Either rename the alias or convert it to a custom command."
)
)]
ExportMainAliasNotAllowed(#[label = "can't export from module"] Span),
@ -299,7 +307,9 @@ pub enum ParseError {
#[error("Overlay prefix mismatch.")]
#[diagnostic(
code(nu::parser::overlay_prefix_mismatch),
help("Overlay {0} already exists {1} a prefix. To add it again, do it {1} the --prefix flag.")
help(
"Overlay {0} already exists {1} a prefix. To add it again, do it {1} the --prefix flag."
)
)]
OverlayPrefixMismatch(
String,
@ -310,7 +320,9 @@ pub enum ParseError {
#[error("Module or overlay not found.")]
#[diagnostic(
code(nu::parser::module_or_overlay_not_found),
help("Requires either an existing overlay, a module, or an import pattern defining a module.")
help(
"Requires either an existing overlay, a module, or an import pattern defining a module."
)
)]
ModuleOrOverlayNotFound(#[label = "not a module or an overlay"] Span),
@ -474,7 +486,9 @@ pub enum ParseError {
#[error("Plugin not found")]
#[diagnostic(
code(nu::parser::plugin_not_found),
help("plugins need to be added to the plugin registry file before your script is run (see `plugin add`)"),
help(
"plugins need to be added to the plugin registry file before your script is run (see `plugin add`)"
)
)]
PluginNotFound {
name: String,
@ -513,7 +527,9 @@ pub enum ParseError {
#[error("This command does not have a ...rest parameter")]
#[diagnostic(
code(nu::parser::unexpected_spread_arg),
help("To spread arguments, the command needs to define a multi-positional parameter in its signature, such as ...rest")
help(
"To spread arguments, the command needs to define a multi-positional parameter in its signature, such as ...rest"
)
)]
UnexpectedSpreadArg(String, #[label = "unexpected spread argument"] Span),

View File

@ -10,7 +10,9 @@ pub enum ParseWarning {
DeprecatedWarning {
old_command: String,
new_suggestion: String,
#[label("`{old_command}` is deprecated and will be removed in a future release. Please {new_suggestion} instead.")]
#[label(
"`{old_command}` is deprecated and will be removed in a future release. Please {new_suggestion} instead."
)]
span: Span,
url: String,
},

View File

@ -8,7 +8,7 @@ use thiserror::Error;
use crate::Span;
use super::{location::Location, ShellError};
use super::{ShellError, location::Location};
/// Represents an I/O error in the [`ShellError::Io`] variant.
///

View File

@ -1,7 +1,7 @@
use super::chained_error::ChainedError;
use crate::{
ast::Operator, engine::StateWorkingSet, format_shell_error, record, ConfigError, LabeledError,
ParseError, Span, Spanned, Type, Value,
ConfigError, LabeledError, ParseError, Span, Spanned, Type, Value, ast::Operator,
engine::StateWorkingSet, format_shell_error, record,
};
use miette::Diagnostic;
use serde::{Deserialize, Serialize};
@ -312,8 +312,9 @@ pub enum ShellError {
#[diagnostic(
code(nu::shell::nushell_failed),
help(
"This shouldn't happen. Please file an issue: https://github.com/nushell/nushell/issues"
))]
"This shouldn't happen. Please file an issue: https://github.com/nushell/nushell/issues"
)
)]
// Only use this one if Nushell completely falls over and hits a state that isn't possible or isn't recoverable
NushellFailed { msg: String },
@ -326,8 +327,9 @@ pub enum ShellError {
#[diagnostic(
code(nu::shell::nushell_failed_spanned),
help(
"This shouldn't happen. Please file an issue: https://github.com/nushell/nushell/issues"
))]
"This shouldn't happen. Please file an issue: https://github.com/nushell/nushell/issues"
)
)]
// Only use this one if Nushell completely falls over and hits a state that isn't possible or isn't recoverable
NushellFailedSpanned {
msg: String,
@ -823,7 +825,9 @@ pub enum ShellError {
plugin_name: String,
#[label("plugin `{plugin_name}` loaded here")]
span: Option<Span>,
#[help("the format in the plugin registry file is not compatible with this version of Nushell.\n\nTry adding the plugin again with `{}`")]
#[help(
"the format in the plugin registry file is not compatible with this version of Nushell.\n\nTry adding the plugin again with `{}`"
)]
add_command: String,
},
@ -893,9 +897,7 @@ pub enum ShellError {
/// creation of the custom value and its use.
#[error("Custom value failed to decode")]
#[diagnostic(code(nu::shell::custom_value_failed_to_decode))]
#[diagnostic(help(
"the plugin may have been updated and no longer support this custom value"
))]
#[diagnostic(help("the plugin may have been updated and no longer support this custom value"))]
CustomValueFailedToDecode {
msg: String,
#[label("{msg}")]
@ -1167,7 +1169,9 @@ This is an internal Nushell error, please file an issue https://github.com/nushe
#[error("Not a constant.")]
#[diagnostic(
code(nu::shell::not_a_constant),
help("Only a subset of expressions are allowed constants during parsing. Try using the 'const' command or typing the value literally.")
help(
"Only a subset of expressions are allowed constants during parsing. Try using the 'const' command or typing the value literally."
)
)]
NotAConstant {
#[label("Value is not a parse-time constant")]
@ -1183,7 +1187,9 @@ This is an internal Nushell error, please file an issue https://github.com/nushe
#[error("Not a const command.")]
#[diagnostic(
code(nu::shell::not_a_const_command),
help("Only a subset of builtin commands, and custom commands built only from those commands, can run at parse time.")
help(
"Only a subset of builtin commands, and custom commands built only from those commands, can run at parse time."
)
)]
NotAConstCommand {
#[label("This command cannot run at parse time.")]
@ -1240,7 +1246,9 @@ This is an internal Nushell error, please file an issue https://github.com/nushe
#[error("Not a list")]
#[diagnostic(
code(nu::shell::cannot_spread_as_list),
help("Only lists can be spread inside lists and command calls. Try converting the value to a list before spreading.")
help(
"Only lists can be spread inside lists and command calls. Try converting the value to a list before spreading."
)
)]
CannotSpreadAsList {
#[label = "cannot spread value"]
@ -1255,7 +1263,9 @@ This is an internal Nushell error, please file an issue https://github.com/nushe
#[error("Not a record")]
#[diagnostic(
code(nu::shell::cannot_spread_as_record),
help("Only records can be spread inside records. Try converting the value to a record before spreading.")
help(
"Only records can be spread inside records. Try converting the value to a record before spreading."
)
)]
CannotSpreadAsRecord {
#[label = "cannot spread value"]
@ -1310,7 +1320,9 @@ On Windows, this would be %USERPROFILE%\AppData\Roaming"#
},
/// XDG_CONFIG_HOME was set to an invalid path
#[error("$env.XDG_CONFIG_HOME ({xdg}) is invalid, using default config directory instead: {default}")]
#[error(
"$env.XDG_CONFIG_HOME ({xdg}) is invalid, using default config directory instead: {default}"
)]
#[diagnostic(
code(nu::shell::xdg_config_home_invalid),
help("Set XDG_CONFIG_HOME to an absolute path, or set it to an empty string to ignore it")
@ -1326,7 +1338,9 @@ On Windows, this would be %USERPROFILE%\AppData\Roaming"#
#[error("IR evaluation error: {msg}")]
#[diagnostic(
code(nu::shell::ir_eval_error),
help("this is a bug, please report it at https://github.com/nushell/nushell/issues/new along with the code you were running if able")
help(
"this is a bug, please report it at https://github.com/nushell/nushell/issues/new along with the code you were running if able"
)
)]
IrEvalError {
msg: String,
@ -1568,19 +1582,25 @@ mod test {
impl From<std::io::Error> for ShellError {
fn from(_: std::io::Error) -> ShellError {
unimplemented!("This implementation is defined in the test module to ensure no other implementation exists.")
unimplemented!(
"This implementation is defined in the test module to ensure no other implementation exists."
)
}
}
impl From<Spanned<std::io::Error>> for ShellError {
fn from(_: Spanned<std::io::Error>) -> Self {
unimplemented!("This implementation is defined in the test module to ensure no other implementation exists.")
unimplemented!(
"This implementation is defined in the test module to ensure no other implementation exists."
)
}
}
impl From<ShellError> for std::io::Error {
fn from(_: ShellError) -> Self {
unimplemented!("This implementation is defined in the test module to ensure no other implementation exists.")
unimplemented!(
"This implementation is defined in the test module to ensure no other implementation exists."
)
}
}
}

View File

@ -1,11 +1,11 @@
//! Foundational [`Eval`] trait allowing dispatch between const-eval and regular evaluation
use crate::{
BlockId, Config, ENV_VARIABLE_ID, GetSpan, Range, Record, ShellError, Span, Value, VarId,
ast::{
eval_operator, Assignment, Bits, Boolean, Call, Comparison, Expr, Expression,
ExternalArgument, ListItem, Math, Operator, RecordItem,
Assignment, Bits, Boolean, Call, Comparison, Expr, Expression, ExternalArgument, ListItem,
Math, Operator, RecordItem, eval_operator,
},
debugger::DebugContext,
BlockId, Config, GetSpan, Range, Record, ShellError, Span, Value, VarId, ENV_VARIABLE_ID,
};
use std::{borrow::Cow, collections::HashMap, sync::Arc};

View File

@ -3,12 +3,12 @@
//! This enables you to assign `const`-constants and execute parse-time code dependent on this.
//! e.g. `source $my_const`
use crate::{
BlockId, Config, HistoryFileFormat, PipelineData, Record, ShellError, Span, Value, VarId,
ast::{Assignment, Block, Call, Expr, Expression, ExternalArgument},
debugger::{DebugContext, WithoutDebug},
engine::{EngineState, StateWorkingSet},
eval_base::Eval,
record, BlockId, Config, HistoryFileFormat, PipelineData, Record, ShellError, Span, Value,
VarId,
record,
};
use nu_system::os_info::{get_kernel_version, get_os_arch, get_os_family, get_os_name};
use std::{

View File

@ -1,9 +1,9 @@
use std::sync::Arc;
use crate::{
DeclId, ShellError, Span, Spanned, Value,
ast::Expression,
engine::{self, Argument, Stack},
DeclId, ShellError, Span, Spanned, Value,
};
use super::DataSlice;
@ -191,7 +191,7 @@ impl Call {
_ => {
return Err(ShellError::CannotSpreadAsList {
span: rest_val.span(),
})
});
}
}
} else {

View File

@ -1,5 +1,5 @@
use super::{DataSlice, Instruction, IrBlock, Literal, RedirectMode};
use crate::{ast::Pattern, engine::EngineState, DeclId, VarId};
use crate::{DeclId, VarId, ast::Pattern, engine::EngineState};
use std::fmt::{self};
pub struct FmtIrBlock<'a> {

View File

@ -1,7 +1,7 @@
use crate::{
BlockId, DeclId, Filesize, RegId, Span, Value, VarId,
ast::{CellPath, Expression, Operator, Pattern, RangeInclusion},
engine::EngineState,
BlockId, DeclId, Filesize, RegId, Span, Value, VarId,
};
use chrono::{DateTime, FixedOffset};
use serde::{Deserialize, Serialize};

View File

@ -94,11 +94,7 @@ pub fn lev_distance_with_substrings(a: &str, b: &str, limit: usize) -> Option<us
score + len_diff
};
if score <= limit {
Some(score)
} else {
None
}
if score <= limit { Some(score) } else { None }
}
/// Finds the best match for given word in the given iterator where substrings are meaningful.

View File

@ -1,6 +1,6 @@
use crate::{
ast::ImportPatternMember, engine::StateWorkingSet, BlockId, DeclId, FileId, ModuleId,
ParseError, Span, Value, VarId,
BlockId, DeclId, FileId, ModuleId, ParseError, Span, Value, VarId, ast::ImportPatternMember,
engine::StateWorkingSet,
};
use crate::parser_path::ParserPath;
@ -200,7 +200,10 @@ impl Module {
// `use a b c`: but b is not a sub-module of a.
let errors = if !rest.is_empty() && self.submodules.get(name).is_none() {
vec![ParseError::WrongImportPattern(
format!("Trying to import something but the parent `{}` is not a module, maybe you want to try `use <module> [<name1>, <name2>]`", String::from_utf8_lossy(name)),
format!(
"Trying to import something but the parent `{}` is not a module, maybe you want to try `use <module> [<name1>, <name2>]`",
String::from_utf8_lossy(name)
),
rest[0].span(),
)]
} else {

View File

@ -1,6 +1,6 @@
use crate::{
engine::{StateWorkingSet, VirtualPath},
FileId,
engine::{StateWorkingSet, VirtualPath},
};
use std::{
ffi::OsStr,

View File

@ -5,8 +5,8 @@
#[cfg(feature = "os")]
use crate::process::{ChildPipe, ChildProcess};
use crate::{
shell_error::{bridge::ShellErrorBridge, io::IoError},
IntRange, PipelineData, ShellError, Signals, Span, Type, Value,
shell_error::{bridge::ShellErrorBridge, io::IoError},
};
use serde::{Deserialize, Serialize};
use std::ops::Bound;

View File

@ -1,7 +1,7 @@
use std::fmt::Debug;
use std::sync::{Arc, Mutex};
use crate::{engine::Sequence, ShellError, SignalAction};
use crate::{ShellError, SignalAction, engine::Sequence};
/// Handler is a closure that can be sent across threads and shared.
pub type Handler = Box<dyn Fn(SignalAction) + Send + Sync>;

View File

@ -1,10 +1,10 @@
use crate::{
ByteStream, ByteStreamType, Config, ListStream, OutDest, PipelineMetadata, Range, ShellError,
Signals, Span, Type, Value,
ast::{Call, PathMember},
engine::{EngineState, Stack},
location,
shell_error::{io::IoError, location::Location},
ByteStream, ByteStreamType, Config, ListStream, OutDest, PipelineMetadata, Range, ShellError,
Signals, Span, Type, Value,
};
use std::{borrow::Cow, io::Write};
@ -347,7 +347,7 @@ impl PipelineData {
wrong_type: other.get_type().to_string(),
dst_span: span,
src_span: val_span,
})
});
}
}
}
@ -360,7 +360,7 @@ impl PipelineData {
wrong_type: "null".into(),
dst_span: span,
src_span: span,
})
});
}
PipelineData::ByteStream(stream, ..) => {
if let Some(chunks) = stream.chunks() {

View File

@ -2,8 +2,8 @@ use crate::{ShellError, Span};
use nu_glob::Interruptible;
use serde::{Deserialize, Serialize};
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
atomic::{AtomicBool, Ordering},
};
/// Used to check for signals to suspend or terminate the execution of Nushell code.

View File

@ -1,8 +1,8 @@
use crate::{
ShellError, Span,
byte_stream::convert_file,
engine::{EngineState, FrozenJob, Job},
shell_error::io::IoError,
ShellError, Span,
};
use nu_system::{ExitStatus, ForegroundChild, ForegroundWaitStatus};

View File

@ -1,6 +1,6 @@
use crate::{
engine::{Call, Command, CommandType, EngineState, Stack},
BlockId, Example, PipelineData, ShellError, SyntaxShape, Type, Value, VarId,
engine::{Call, Command, CommandType, EngineState, Stack},
};
use nu_derive_value::FromValue;
use serde::{Deserialize, Serialize};

View File

@ -1,6 +1,6 @@
use std::{cmp::Ordering, fmt};
use crate::{ast::Operator, ShellError, Span, Type, Value};
use crate::{ShellError, Span, Type, Value, ast::Operator};
/// Trait definition for a custom [`Value`](crate::Value) type
#[typetag::serde(tag = "type")]

View File

@ -1,7 +1,7 @@
use crate::{
NuGlob, Range, Record, ShellError, Span, Spanned, Type, Value,
ast::{CellPath, PathMember},
engine::Closure,
NuGlob, Range, Record, ShellError, Span, Spanned, Type, Value,
};
use chrono::{DateTime, FixedOffset};
use std::{
@ -771,7 +771,7 @@ fn int_too_large_error(int: impl fmt::Display, max: impl fmt::Display, span: Spa
#[cfg(test)]
mod tests {
use crate::{engine::Closure, FromValue, IntoValue, Record, Span, Type, Value};
use crate::{FromValue, IntoValue, Record, Span, Type, Value, engine::Closure};
use std::ops::Deref;
#[test]

View File

@ -1,4 +1,4 @@
use crate::{ast::CellPath, engine::Closure, Range, Record, ShellError, Span, Value};
use crate::{Range, Record, ShellError, Span, Value, ast::CellPath, engine::Closure};
use chrono::{DateTime, FixedOffset};
use std::{borrow::Borrow, collections::HashMap};

View File

@ -20,18 +20,17 @@ pub use range::{FloatRange, IntRange, Range};
pub use record::Record;
use crate::{
BlockId, Config, ShellError, Signals, Span, Type,
ast::{Bits, Boolean, CellPath, Comparison, Math, Operator, PathMember},
did_you_mean,
engine::{Closure, EngineState},
BlockId, Config, ShellError, Signals, Span, Type,
};
use chrono::{DateTime, Datelike, Duration, FixedOffset, Local, Locale, TimeZone};
use chrono_humanize::HumanTime;
use fancy_regex::Regex;
use nu_utils::{
contains_emoji,
locale::{get_system_locale_string, LOCALE_OVERRIDE_ENV_VAR},
IgnoreCaseExt, SharedCow,
IgnoreCaseExt, SharedCow, contains_emoji,
locale::{LOCALE_OVERRIDE_ENV_VAR, get_system_locale_string},
};
use serde::{Deserialize, Serialize};
use std::{
@ -1001,7 +1000,7 @@ impl Value {
Some(format) => self.format_datetime(val, format),
None => human_time_from_now(val).to_string(),
},
Value::List { ref vals, .. } => {
Value::List { vals, .. } => {
if !vals.is_empty() && vals.iter().all(|x| matches!(x, Value::Record { .. })) {
format!(
"[table {} row{}]",
@ -1677,16 +1676,16 @@ impl Value {
f(self)?;
// Check for contained values
match self {
Value::Record { ref mut val, .. } => val
Value::Record { val, .. } => val
.to_mut()
.iter_mut()
.try_for_each(|(_, rec_value)| rec_value.recurse_mut(f)),
Value::List { ref mut vals, .. } => vals
Value::List { vals, .. } => vals
.iter_mut()
.try_for_each(|list_value| list_value.recurse_mut(f)),
// Closure captures are visited. Maybe these don't have to be if they are changed to
// more opaque references.
Value::Closure { ref mut val, .. } => val
Value::Closure { val, .. } => val
.captures
.iter_mut()
.map(|(_, captured_value)| captured_value)
@ -2048,7 +2047,7 @@ fn get_value_member<'a>(
})
}
}
Value::Range { ref val, .. } => {
Value::Range { val, .. } => {
if let Some(item) = val
.into_range_iter(current.span(), Signals::empty())
.nth(*count)
@ -2063,7 +2062,7 @@ fn get_value_member<'a>(
})
}
}
Value::Custom { ref val, .. } => {
Value::Custom { val, .. } => {
match val.follow_path_int(current.span(), *count, *origin_span)
{
Ok(val) => Ok(ControlFlow::Continue(Cow::Owned(val))),
@ -2169,7 +2168,7 @@ fn get_value_member<'a>(
Ok(ControlFlow::Continue(Cow::Owned(Value::list(list, span))))
}
Value::Custom { ref val, .. } => {
Value::Custom { val, .. } => {
match val.follow_path_string(current.span(), column_name.clone(), *origin_span)
{
Ok(val) => Ok(ControlFlow::Continue(Cow::Owned(val))),
@ -3341,7 +3340,9 @@ impl Value {
let help = if matches!(self, Value::List { .. })
|| matches!(rhs, Value::List { .. })
{
Some("if you meant to append a value to a list or a record to a table, use the `append` command or wrap the value in a list. For example: `$list ++ $value` should be `$list ++ [$value]` or `$list | append $value`.")
Some(
"if you meant to append a value to a list or a record to a table, use the `append` command or wrap the value in a list. For example: `$list ++ $value` should be `$list ++ [$value]` or `$list | append $value`.",
)
} else {
None
};
@ -4501,14 +4502,18 @@ mod tests {
// complex values returning None
assert!(Value::test_record(Record::default()).coerce_bool().is_err());
assert!(Value::test_list(vec![Value::test_int(1)])
assert!(
Value::test_list(vec![Value::test_int(1)])
.coerce_bool()
.is_err()
);
assert!(
Value::test_date(
chrono::DateTime::parse_from_rfc3339("2024-01-01T12:00:00+00:00").unwrap(),
)
.coerce_bool()
.is_err());
assert!(Value::test_date(
chrono::DateTime::parse_from_rfc3339("2024-01-01T12:00:00+00:00").unwrap(),
)
.coerce_bool()
.is_err());
.is_err()
);
assert!(Value::test_glob("*.rs").coerce_bool().is_err());
assert!(Value::test_binary(vec![1, 2, 3]).coerce_bool().is_err());
assert!(Value::test_duration(3600).coerce_bool().is_err());

View File

@ -1,12 +1,12 @@
//! A Range is an iterator over integers or floats.
use crate::{ast::RangeInclusion, ShellError, Signals, Span, Value};
use crate::{ShellError, Signals, Span, Value, ast::RangeInclusion};
use core::ops::Bound;
use serde::{Deserialize, Serialize};
use std::{cmp::Ordering, fmt::Display};
mod int_range {
use crate::{ast::RangeInclusion, FromValue, ShellError, Signals, Span, Value};
use crate::{FromValue, ShellError, Signals, Span, Value, ast::RangeInclusion};
use serde::{Deserialize, Serialize};
use std::{cmp::Ordering, fmt::Display, ops::Bound};
@ -209,11 +209,7 @@ mod int_range {
(Bound::Included(l), Bound::Included(r))
| (Bound::Excluded(l), Bound::Excluded(r)) => {
let ord = l.cmp(&r);
if self.step < 0 {
ord.reverse()
} else {
ord
}
if self.step < 0 { ord.reverse() } else { ord }
}
(Bound::Included(l), Bound::Excluded(r)) => match l.cmp(&r) {
Ordering::Equal => Ordering::Greater,
@ -312,8 +308,8 @@ mod int_range {
mod float_range {
use crate::{
ast::RangeInclusion, format::ObviousFloat, IntRange, Range, ShellError, Signals, Span,
Value,
IntRange, Range, ShellError, Signals, Span, Value, ast::RangeInclusion,
format::ObviousFloat,
};
use serde::{Deserialize, Serialize};
use std::{cmp::Ordering, fmt::Display, ops::Bound};
@ -479,11 +475,7 @@ mod float_range {
(Bound::Included(l), Bound::Included(r))
| (Bound::Excluded(l), Bound::Excluded(r)) => {
let ord = float_cmp(l, r);
if self.step < 0.0 {
ord.reverse()
} else {
ord
}
if self.step < 0.0 { ord.reverse() } else { ord }
}
(Bound::Included(l), Bound::Excluded(r)) => match float_cmp(l, r) {
Ordering::Equal => Ordering::Greater,

View File

@ -3,7 +3,7 @@ use std::{iter::FusedIterator, ops::RangeBounds};
use crate::{ShellError, Span, Value};
use serde::{de::Visitor, ser::SerializeMap, Deserialize, Serialize};
use serde::{Deserialize, Serialize, de::Visitor, ser::SerializeMap};
#[derive(Debug, Clone, Default)]
pub struct Record {

View File

@ -1,4 +1,4 @@
use crate::{record, FromValue, IntoValue, Record, Span, Value};
use crate::{FromValue, IntoValue, Record, Span, Value, record};
use bytes::Bytes;
use std::collections::HashMap;

View File

@ -50,9 +50,11 @@ fn config_add_unsupported_key() {
r#"$env.config.foo = 2"#,
r#";"#]));
assert!(actual
.err
.contains("Unknown config option: $env.config.foo"));
assert!(
actual
.err
.contains("Unknown config option: $env.config.foo")
);
}
#[test]

View File

@ -1,4 +1,4 @@
use nu_protocol::{ast::RangeInclusion, ByteStream, IntRange, Signals, Span, Value};
use nu_protocol::{ByteStream, IntRange, Signals, Span, Value, ast::RangeInclusion};
#[test]
pub fn test_simple_positive_slice_exclusive() {

View File

@ -1,6 +1,6 @@
use nu_protocol::{
engine::{EngineState, Stack},
Config, Span, Value,
engine::{EngineState, Stack},
};
use rstest::rstest;