diff --git a/crates/nu-protocol/src/value/mod.rs b/crates/nu-protocol/src/value/mod.rs index 28e1a173f6..f767f80e2b 100644 --- a/crates/nu-protocol/src/value/mod.rs +++ b/crates/nu-protocol/src/value/mod.rs @@ -492,40 +492,6 @@ impl PartialOrd for Value { .. }, ) if lhs_headers == rhs_headers && lhs == rhs => Some(Ordering::Equal), - // Note: This may look a bit strange, but a Stream is still just a List, - // it just happens to be in an iterator form instead of a concrete form. If the contained - // values are the same then it should be treated as equal - ( - Value::Stream { - stream: stream_lhs, .. - }, - Value::List { - vals: stream_rhs, .. - }, - ) => { - let vals_lhs: Vec = stream_lhs.clone().collect(); - let vals_rhs: Vec = - stream_rhs.clone().into_iter().into_value_stream().collect(); - - vals_lhs.partial_cmp(&vals_rhs) - } - // Note: This may look a bit strange, but a Stream is still just a List, - // it just happens to be in an iterator form instead of a concrete form. If the contained - // values are the same then it should be treated as equal - ( - Value::List { - vals: stream_lhs, .. - }, - Value::Stream { - stream: stream_rhs, .. - }, - ) => { - let vals_lhs: Vec = - stream_lhs.clone().into_iter().into_value_stream().collect(); - let vals_rhs: Vec = stream_rhs.clone().collect(); - - vals_lhs.partial_cmp(&vals_rhs) - } (Value::Stream { stream: lhs, .. }, Value::Stream { stream: rhs, .. }) => { lhs.clone().partial_cmp(rhs.clone()) } @@ -535,6 +501,9 @@ impl PartialOrd for Value { (Value::String { val: lhs, .. }, Value::Stream { stream: rhs, .. }) => { lhs.partial_cmp(&rhs.clone().collect_string()) } + // NOTE: This may look a bit strange, but a `Stream` is still just a `List`, it just + // happens to be in an iterator form instead of a concrete form. The contained values + // can be compared. (Value::Stream { stream: lhs, .. }, Value::List { vals: rhs, .. }) => { lhs.clone().collect::>().partial_cmp(rhs) } diff --git a/crates/nu-protocol/src/value/range.rs b/crates/nu-protocol/src/value/range.rs index c4636f61ea..8d2bbbb811 100644 --- a/crates/nu-protocol/src/value/range.rs +++ b/crates/nu-protocol/src/value/range.rs @@ -104,10 +104,12 @@ impl Range { }) } + #[inline] fn moves_up(&self) -> bool { self.from <= self.to } + #[inline] fn is_end_inclusive(&self) -> bool { matches!(self.inclusion, RangeInclusion::Inclusive) }