From d0ff53de2d93ef5fa4f70fb47bd1175788b7358f Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Wed, 10 Jul 2019 17:04:38 +0200 Subject: Resolve a FIXME Now that we are using a newer smol_str release this can be simplified :) --- crates/ra_syntax/src/syntax_text.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'crates') diff --git a/crates/ra_syntax/src/syntax_text.rs b/crates/ra_syntax/src/syntax_text.rs index e648dc082..844bd3e13 100644 --- a/crates/ra_syntax/src/syntax_text.rs +++ b/crates/ra_syntax/src/syntax_text.rs @@ -38,9 +38,7 @@ impl<'a> SyntaxText<'a> { } pub fn to_smol_string(&self) -> SmolStr { - // FIXME: use `self.chunks().collect()` here too once - // https://github.com/matklad/smol_str/pull/12 is merged and published - self.to_string().into() + self.chunks().collect() } pub fn contains(&self, c: char) -> bool { -- cgit v1.2.3 From 6e870659684c9c2827eb9b9d62860a993f738953 Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Wed, 10 Jul 2019 17:05:39 +0200 Subject: Make clippy a bit happier Random drive-by fix. I honestly blame rust-analyzer itself on this, because I set its watch mode to use `cargo clippy` :shrug: --- crates/ra_syntax/src/syntax_text.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates') diff --git a/crates/ra_syntax/src/syntax_text.rs b/crates/ra_syntax/src/syntax_text.rs index 844bd3e13..939f2c02f 100644 --- a/crates/ra_syntax/src/syntax_text.rs +++ b/crates/ra_syntax/src/syntax_text.rs @@ -61,6 +61,10 @@ impl<'a> SyntaxText<'a> { self.range.len() } + pub fn is_empty(&self) -> bool { + self.range.is_empty() + } + /// NB, the offsets here are absolute, and this probably doesn't make sense! pub fn slice(&self, range: impl ops::RangeBounds) -> SyntaxText<'a> { let start = match range.start_bound() { -- cgit v1.2.3