Add inline attribute and address warning

This commit is contained in:
Arthur Targaryen 2021-10-09 19:26:20 +02:00
parent d5fdfdb614
commit a0a63c966f
2 changed files with 5 additions and 34 deletions

View File

@ -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<Value> = stream_lhs.clone().collect();
let vals_rhs: Vec<Value> =
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<Value> =
stream_lhs.clone().into_iter().into_value_stream().collect();
let vals_rhs: Vec<Value> = 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::<Vec<Value>>().partial_cmp(rhs)
}

View File

@ -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)
}