diff --git a/src/document.rs b/src/document.rs index cc73f1e..ad5b9ad 100644 --- a/src/document.rs +++ b/src/document.rs @@ -60,14 +60,8 @@ impl KdlDocument { /// but may become invalidated if the document is mutated. We do not currently /// guarantee this to yield any particularly consistent results at that point. #[cfg(feature = "span")] - pub fn span(&self) -> &SourceSpan { - &self.span - } - - /// Gets a mutable reference to this document's span. - #[cfg(feature = "span")] - pub fn span_mut(&mut self) -> &mut SourceSpan { - &mut self.span + pub fn span(&self) -> SourceSpan { + self.span } /// Sets this document's span. @@ -587,8 +581,8 @@ foo 1 bar=0xdeadbeef { #[cfg(feature = "span")] #[track_caller] - fn check_span(expected: &str, span: &SourceSpan, source: &impl miette::SourceCode) { - let span = source.read_span(span, 0, 0).unwrap(); + fn check_span(expected: &str, span: SourceSpan, source: &impl miette::SourceCode) { + let span = source.read_span(&span, 0, 0).unwrap(); let span = std::str::from_utf8(span.data()).unwrap(); assert_eq!(span, expected); } diff --git a/src/entry.rs b/src/entry.rs index dba2b6e..7d8e43d 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -73,14 +73,8 @@ impl KdlEntry { /// but may become invalidated if the document is mutated. We do not currently /// guarantee this to yield any particularly consistent results at that point. #[cfg(feature = "span")] - pub fn span(&self) -> &SourceSpan { - &self.span - } - - /// Gets a mutable reference to this entry's span. - #[cfg(feature = "span")] - pub fn span_mut(&mut self) -> &mut SourceSpan { - &mut self.span + pub fn span(&self) -> SourceSpan { + self.span } /// Sets this entry's span. diff --git a/src/identifier.rs b/src/identifier.rs index eb5444a..27288ee 100644 --- a/src/identifier.rs +++ b/src/identifier.rs @@ -46,14 +46,8 @@ impl KdlIdentifier { /// but may become invalidated if the document is mutated. We do not currently /// guarantee this to yield any particularly consistent results at that point. #[cfg(feature = "span")] - pub fn span(&self) -> &SourceSpan { - &self.span - } - - /// Gets a mutable reference to this identifier's span. - #[cfg(feature = "span")] - pub fn span_mut(&mut self) -> &mut SourceSpan { - &mut self.span + pub fn span(&self) -> SourceSpan { + self.span } /// Sets this identifier's span. diff --git a/src/node.rs b/src/node.rs index adee4d1..b478bc9 100644 --- a/src/node.rs +++ b/src/node.rs @@ -76,14 +76,8 @@ impl KdlNode { /// but may become invalidated if the document is mutated. We do not currently /// guarantee this to yield any particularly consistent results at that point. #[cfg(feature = "span")] - pub fn span(&self) -> &SourceSpan { - &self.span - } - - /// Gets a mutable reference to this node's span. - #[cfg(feature = "span")] - pub fn span_mut(&mut self) -> &mut SourceSpan { - &mut self.span + pub fn span(&self) -> SourceSpan { + self.span } /// Sets this node's span.