Skip to content

Commit

Permalink
Simplify comparsion of items for QueryResultView
Browse files Browse the repository at this point in the history
  • Loading branch information
azat committed Oct 27, 2023
1 parent 523ca8a commit 6031254
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/view/query_result_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,7 @@ impl TableViewItem<u8> for Row {
let index = column as usize;
let field_lhs = &self.0[index];
let field_rhs = &other.0[index];
match (field_lhs, field_rhs) {
(Field::String(ref lhs), Field::String(ref rhs)) => lhs.cmp(&rhs),
(Field::Float64(ref lhs), Field::Float64(ref rhs)) => lhs.partial_cmp(&rhs).unwrap(),
(Field::Float32(ref lhs), Field::Float32(ref rhs)) => lhs.partial_cmp(&rhs).unwrap(),
(Field::UInt64(ref lhs), Field::UInt64(ref rhs)) => lhs.cmp(&rhs),
(Field::UInt32(ref lhs), Field::UInt32(ref rhs)) => lhs.cmp(&rhs),
(Field::UInt8(ref lhs), Field::UInt8(ref rhs)) => lhs.cmp(&rhs),
(Field::Int64(ref lhs), Field::Int64(ref rhs)) => lhs.cmp(&rhs),
(Field::Int32(ref lhs), Field::Int32(ref rhs)) => lhs.cmp(&rhs),
(Field::Int8(ref lhs), Field::Int8(ref rhs)) => lhs.cmp(&rhs),
(Field::DateTime(ref lhs), Field::DateTime(ref rhs)) => lhs.cmp(&rhs),
_ => unreachable!(
"Type for field ({:?}, {:?}) not implemented",
field_lhs, field_rhs
),
}
return field_lhs.partial_cmp(field_rhs).unwrap();
}
}

Expand Down

0 comments on commit 6031254

Please sign in to comment.