Use &Snapshot directly instead of impl Into<Content<'a>>

The text::Buffer and its snapshot already used the same representation
for their content, so we can just make Buffer deref to a Snapshot.
This commit is contained in:
Max Brunsfeld 2021-11-30 13:29:04 -08:00
parent 36546463e6
commit 924e1578ea
10 changed files with 197 additions and 436 deletions

View file

@ -1,6 +1,15 @@
use super::*;
use gpui::{ModelHandle, MutableAppContext, Task};
use std::{any::Any, cell::RefCell, ffi::OsString, iter::FromIterator, ops::Range, path::PathBuf, rc::Rc, time::{Duration, Instant, SystemTime}};
use std::{
any::Any,
cell::RefCell,
ffi::OsString,
iter::FromIterator,
ops::Range,
path::PathBuf,
rc::Rc,
time::{Duration, Instant, SystemTime},
};
use unindent::Unindent as _;
#[test]
@ -359,7 +368,7 @@ fn test_autoindent_moves_selections(cx: &mut MutableAppContext) {
let selection_ranges = buffer
.selection_set(selection_set_id)
.unwrap()
.selections::<Point, _>(&buffer)
.selections::<Point>(&buffer)
.map(|selection| selection.point_range(&buffer))
.collect::<Vec<_>>();