Change language::min() to a constant

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Keith Simmons 2022-03-24 10:35:30 -07:00
parent f6805eb802
commit ab631cf6c3
10 changed files with 33 additions and 62 deletions

View file

@ -12,21 +12,17 @@ pub struct Anchor {
}
impl Anchor {
pub fn build_min() -> Self {
Self {
timestamp: clock::Local::MIN,
offset: usize::MIN,
bias: Bias::Left,
}
}
pub const MIN: Self = Self {
timestamp: clock::Local::MIN,
offset: usize::MIN,
bias: Bias::Left,
};
pub fn build_max() -> Self {
Self {
timestamp: clock::Local::MAX,
offset: usize::MAX,
bias: Bias::Right,
}
}
pub const MAX: Self = Self {
timestamp: clock::Local::MAX,
offset: usize::MAX,
bias: Bias::Right,
};
pub fn cmp(&self, other: &Anchor, buffer: &BufferSnapshot) -> Result<Ordering> {
let fragment_id_comparison = if self.timestamp == other.timestamp {