From 12e3b4c70b5ef23b2fdfc197296d483680e125f9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 8 Feb 2019 14:49:43 +0300 Subject: reformat the world --- crates/ra_text_edit/src/lib.rs | 5 +---- crates/ra_text_edit/src/test_utils.rs | 8 ++------ crates/ra_text_edit/src/text_edit.rs | 4 +--- 3 files changed, 4 insertions(+), 13 deletions(-) (limited to 'crates/ra_text_edit') diff --git a/crates/ra_text_edit/src/lib.rs b/crates/ra_text_edit/src/lib.rs index fb693b3ae..df673ba18 100644 --- a/crates/ra_text_edit/src/lib.rs +++ b/crates/ra_text_edit/src/lib.rs @@ -15,10 +15,7 @@ pub struct AtomTextEdit { impl AtomTextEdit { pub fn replace(range: TextRange, replace_with: String) -> AtomTextEdit { - AtomTextEdit { - delete: range, - insert: replace_with, - } + AtomTextEdit { delete: range, insert: replace_with } } pub fn delete(range: TextRange) -> AtomTextEdit { diff --git a/crates/ra_text_edit/src/test_utils.rs b/crates/ra_text_edit/src/test_utils.rs index 745f21c93..9e21b24f6 100644 --- a/crates/ra_text_edit/src/test_utils.rs +++ b/crates/ra_text_edit/src/test_utils.rs @@ -8,9 +8,7 @@ pub fn arb_text() -> proptest::string::RegexGeneratorStrategy { } fn text_offsets(text: &str) -> Vec { - text.char_indices() - .map(|(i, _)| TextUnit::from_usize(i)) - .collect() + text.char_indices().map(|(i, _)| TextUnit::from_usize(i)).collect() } pub fn arb_offset(text: &str) -> BoxedStrategy { @@ -56,9 +54,7 @@ pub fn arb_text_edit(text: &str) -> BoxedStrategy { ) .boxed() } - &[x] => arb_text() - .prop_map(move |text| AtomTextEdit::insert(x, text)) - .boxed(), + &[x] => arb_text().prop_map(move |text| AtomTextEdit::insert(x, text)).boxed(), _ => unreachable!(), }) .collect(); diff --git a/crates/ra_text_edit/src/text_edit.rs b/crates/ra_text_edit/src/text_edit.rs index 363b3d8c0..8522f99bd 100644 --- a/crates/ra_text_edit/src/text_edit.rs +++ b/crates/ra_text_edit/src/text_edit.rs @@ -25,9 +25,7 @@ impl TextEditBuilder { TextEdit::from_atoms(self.atoms) } pub fn invalidates_offset(&self, offset: TextUnit) -> bool { - self.atoms - .iter() - .any(|atom| atom.delete.contains_inclusive(offset)) + self.atoms.iter().any(|atom| atom.delete.contains_inclusive(offset)) } } -- cgit v1.2.3