feat: make SourceSpan implement Copy

SourceSpan is just a pair of usizes, so it's cheap to copy.
This commit is contained in:
Rain 2022-04-15 18:51:31 -07:00
parent 97197601ee
commit 3fb25b40a8
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ impl SourceCode for NamedSource {
Ok(Box::new(MietteSpanContents::new_named(
self.name.clone(),
contents.data(),
contents.span().clone(),
*contents.span(),
contents.line(),
contents.column(),
contents.line_count(),

View File

@ -345,7 +345,7 @@ impl<'a> SpanContents<'a> for MietteSpanContents<'a> {
/**
Span within a [`SourceCode`] with an associated message.
*/
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub struct SourceSpan {
/// The start of the span.
offset: SourceOffset,