Remove some Clippy allows (#1888)

This commit is contained in:
Charlie Marsh
2023-01-15 02:32:36 -05:00
committed by GitHub
parent 3791ca721a
commit 5c6753e69e
16 changed files with 31 additions and 43 deletions

View File

@@ -25,15 +25,13 @@ impl<'a> Locator<'a> {
self.rope.get_or_init(|| Rope::from_str(self.contents))
}
#[allow(clippy::trivially_copy_pass_by_ref)]
pub fn slice_source_code_at(&self, location: &Location) -> Cow<'_, str> {
pub fn slice_source_code_at(&self, location: Location) -> Cow<'_, str> {
let rope = self.get_or_init_rope();
let offset = rope.line_to_char(location.row() - 1) + location.column();
Cow::from(rope.slice(offset..))
}
#[allow(clippy::trivially_copy_pass_by_ref)]
pub fn slice_source_code_until(&self, location: &Location) -> Cow<'_, str> {
pub fn slice_source_code_until(&self, location: Location) -> Cow<'_, str> {
let rope = self.get_or_init_rope();
let offset = rope.line_to_char(location.row() - 1) + location.column();
Cow::from(rope.slice(..offset))