Fix clippy::trivially-copy-pass-by-ref (pedantic) (#862)

This commit is contained in:
Anders Kaseorg
2022-11-21 12:59:51 -08:00
committed by GitHub
parent 6b9e57fb78
commit 58949b564e
18 changed files with 53 additions and 53 deletions

View File

@@ -25,7 +25,7 @@ impl<'a> SourceCodeLocator<'a> {
self.rope.get_or_init(|| Rope::from_str(self.contents))
}
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..))