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

@ -491,7 +491,7 @@ mod tests {
use super::*;
use crate::{
movement,
test::{marked_text, marked_text_ranges},
test::{marked_text_ranges},
};
use gpui::{color::Color, elements::*, test::observe, MutableAppContext};
use language::{Buffer, Language, LanguageConfig, RandomCharIter, SelectionGoal};
@ -499,7 +499,6 @@ mod tests {
use smol::stream::StreamExt;
use std::{env, sync::Arc};
use theme::SyntaxTheme;
use unindent::Unindent;
use util::test::sample_text;
use Bias::*;

View file

@ -4,8 +4,6 @@ pub mod items;
pub mod movement;
mod multi_buffer;
pub mod repro;
#[cfg(test)]
mod test;
@ -4422,13 +4420,7 @@ impl Editor {
.into_iter()
.flat_map(|(_, ranges)| ranges),
)
.collect::<Vec<_>>();
let snapshot = this.buffer.read(cx).snapshot(cx);
let point_ranges = ranges
.iter()
.map(|range| range.to_point(&snapshot))
.collect::<Vec<_>>();
.collect();
this.highlight_text::<Rename>(
ranges,

View file

@ -211,11 +211,7 @@ impl MultiBuffer {
pub fn singleton(buffer: ModelHandle<Buffer>, cx: &mut ModelContext<Self>) -> Self {
let mut this = Self::new(buffer.read(cx).replica_id());
this.singleton = true;
this.push_excerpts(
buffer,
[text::Anchor::build_min()..text::Anchor::build_max()],
cx,
);
this.push_excerpts(buffer, [text::Anchor::MIN..text::Anchor::MAX], cx);
this.snapshot.borrow_mut().singleton = true;
this
}

View file

@ -19,7 +19,7 @@ impl Anchor {
Self {
buffer_id: None,
excerpt_id: ExcerptId::min(),
text_anchor: text::Anchor::build_min(),
text_anchor: text::Anchor::MIN,
}
}
@ -27,7 +27,7 @@ impl Anchor {
Self {
buffer_id: None,
excerpt_id: ExcerptId::max(),
text_anchor: text::Anchor::build_max(),
text_anchor: text::Anchor::MAX,
}
}

View file

@ -1,9 +0,0 @@
fn test(complicated: i32, test: i32) {
complicated;
test;
// 1
// 2
// 3
complicated;
test;
}