mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 13:46:03 +02:00
Range
refactor (#12405)
# Description Currently, `Range` is a struct with a `from`, `to`, and `incr` field, which are all type `Value`. This PR changes `Range` to be an enum over `IntRange` and `FloatRange` for better type safety / stronger compile time guarantees. Fixes: #11778 Fixes: #11777 Fixes: #11776 Fixes: #11775 Fixes: #11774 Fixes: #11773 Fixes: #11769. # User-Facing Changes Hopefully none, besides bug fixes. Although, the `serde` representation might have changed.
This commit is contained in:
@ -257,13 +257,7 @@ pub fn debug_string_without_formatting(value: &Value) -> String {
|
||||
Value::Filesize { val, .. } => val.to_string(),
|
||||
Value::Duration { val, .. } => val.to_string(),
|
||||
Value::Date { val, .. } => format!("{val:?}"),
|
||||
Value::Range { val, .. } => {
|
||||
format!(
|
||||
"{}..{}",
|
||||
debug_string_without_formatting(&val.from),
|
||||
debug_string_without_formatting(&val.to)
|
||||
)
|
||||
}
|
||||
Value::Range { val, .. } => val.to_string(),
|
||||
Value::String { val, .. } => val.clone(),
|
||||
Value::Glob { val, .. } => val.clone(),
|
||||
Value::List { vals: val, .. } => format!(
|
||||
|
Reference in New Issue
Block a user