From f553837c1ca30a52bf5091689c21d3c3e3362395 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 8 Jan 2019 21:50:04 +0300 Subject: upstream text-utils to text_unit --- crates/ra_text_edit/src/lib.rs | 1 - crates/ra_text_edit/src/text_edit.rs | 3 +-- crates/ra_text_edit/src/text_utils.rs | 5 ----- 3 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 crates/ra_text_edit/src/text_utils.rs (limited to 'crates/ra_text_edit/src') diff --git a/crates/ra_text_edit/src/lib.rs b/crates/ra_text_edit/src/lib.rs index 8acf10448..22f3fdc0c 100644 --- a/crates/ra_text_edit/src/lib.rs +++ b/crates/ra_text_edit/src/lib.rs @@ -1,5 +1,4 @@ mod text_edit; -pub mod text_utils; pub mod test_utils; pub use crate::text_edit::{TextEdit, TextEditBuilder}; diff --git a/crates/ra_text_edit/src/text_edit.rs b/crates/ra_text_edit/src/text_edit.rs index a288a990d..363b3d8c0 100644 --- a/crates/ra_text_edit/src/text_edit.rs +++ b/crates/ra_text_edit/src/text_edit.rs @@ -1,5 +1,4 @@ use crate::AtomTextEdit; -use crate::text_utils::contains_offset_nonstrict; use text_unit::{TextRange, TextUnit}; #[derive(Debug, Clone)] @@ -28,7 +27,7 @@ impl TextEditBuilder { pub fn invalidates_offset(&self, offset: TextUnit) -> bool { self.atoms .iter() - .any(|atom| contains_offset_nonstrict(atom.delete, offset)) + .any(|atom| atom.delete.contains_inclusive(offset)) } } diff --git a/crates/ra_text_edit/src/text_utils.rs b/crates/ra_text_edit/src/text_utils.rs deleted file mode 100644 index e3b4dc4fe..000000000 --- a/crates/ra_text_edit/src/text_utils.rs +++ /dev/null @@ -1,5 +0,0 @@ -use text_unit::{TextRange, TextUnit}; - -pub fn contains_offset_nonstrict(range: TextRange, offset: TextUnit) -> bool { - range.start() <= offset && offset <= range.end() -} -- cgit v1.2.3