feat(spans): make SourceSpan implement Copy (#151)

SourceSpan is just a pair of usizes, so it's cheap to copy.
This commit is contained in:
Rain 2022-04-17 15:27:11 -07:00 committed by GitHub
parent 97197601ee
commit 5e54b29acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,