summaryrefslogtreecommitdiff
path: root/src/source.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-08-21 16:38:51 +0200
committerLaurenz <laurmaedje@gmail.com>2021-08-21 17:30:21 +0200
commit0dd4ae0a7ac0c247078df492469ff20b8a90c886 (patch)
tree07a55343b9ccab3fe76b0f1b0de9d1be310d8b14 /src/source.rs
parentf38eb10c2b54bd13ccef119454839f6a66448462 (diff)
Prune derives
Diffstat (limited to 'src/source.rs')
-rw-r--r--src/source.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/source.rs b/src/source.rs
index 877fd729..b02af1b6 100644
--- a/src/source.rs
+++ b/src/source.rs
@@ -15,8 +15,7 @@ use crate::parse::{is_newline, Scanner};
use crate::util::PathExt;
/// A unique identifier for a loaded source file.
-#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Serialize, Deserialize)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct SourceId(u32);
impl SourceId {
@@ -252,12 +251,6 @@ impl SourceFile {
}
}
-impl AsRef<str> for SourceFile {
- fn as_ref(&self) -> &str {
- &self.src
- }
-}
-
/// The indices at which lines start (right behind newlines).
///
/// The beginning of the string (index 0) is not returned.
@@ -276,6 +269,12 @@ fn newlines(string: &str) -> impl Iterator<Item = usize> + '_ {
})
}
+impl AsRef<str> for SourceFile {
+ fn as_ref(&self) -> &str {
+ &self.src
+ }
+}
+
#[cfg(feature = "codespan-reporting")]
impl<'a> Files<'a> for SourceStore {
type FileId = SourceId;