From a307149d28add9019d8466780bd4b398d976b13b Mon Sep 17 00:00:00 2001 From: David Binder Date: Sun, 12 May 2024 20:20:17 +0200 Subject: [PATCH] Fix clippy hints --- src/file.rs | 2 +- src/index.rs | 5 +++++ src/span.rs | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/file.rs b/src/file.rs index e3430c9a..c9e17d3f 100644 --- a/src/file.rs +++ b/src/file.rs @@ -355,7 +355,7 @@ where } pub fn source_span(&self) -> Span { - Span::from_str(self.source.as_ref()) + Span::from_string(self.source.as_ref()) } pub fn source_slice(&self, span: Span) -> Result<&str, Error> { diff --git a/src/index.rs b/src/index.rs index 6c6c3b21..473c33d4 100644 --- a/src/index.rs +++ b/src/index.rs @@ -33,6 +33,7 @@ impl LineIndex { } } +#[allow(clippy::derivable_impls)] impl Default for LineIndex { fn default() -> LineIndex { LineIndex(0) @@ -82,6 +83,7 @@ impl fmt::Display for LineNumber { #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct LineOffset(pub RawOffset); +#[allow(clippy::derivable_impls)] impl Default for LineOffset { fn default() -> LineOffset { LineOffset(0) @@ -125,6 +127,7 @@ impl ColumnIndex { } } +#[allow(clippy::derivable_impls)] impl Default for ColumnIndex { fn default() -> ColumnIndex { ColumnIndex(0) @@ -167,6 +170,7 @@ impl fmt::Display for ColumnNumber { #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct ColumnOffset(pub RawOffset); +#[allow(clippy::derivable_impls)] impl Default for ColumnOffset { fn default() -> ColumnOffset { ColumnOffset(0) @@ -198,6 +202,7 @@ impl ByteIndex { } } +#[allow(clippy::derivable_impls)] impl Default for ByteIndex { fn default() -> ByteIndex { ByteIndex(0) diff --git a/src/span.rs b/src/span.rs index e323687c..91db4bde 100644 --- a/src/span.rs +++ b/src/span.rs @@ -37,7 +37,7 @@ impl Span { /// /// assert_eq!(span, Span::new(0, 5)); /// ``` - pub fn from_str(s: &str) -> Span { + pub fn from_string(s: &str) -> Span { Span::new(0, s.len() as u32) }