Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/span/src/lib.rs')
-rw-r--r--crates/span/src/lib.rs23
1 files changed, 3 insertions, 20 deletions
diff --git a/crates/span/src/lib.rs b/crates/span/src/lib.rs
index f6581de38c..bfe7b2620d 100644
--- a/crates/span/src/lib.rs
+++ b/crates/span/src/lib.rs
@@ -20,7 +20,6 @@ pub use self::{
map::{RealSpanMap, SpanMap},
};
-use serde::{Deserialize, Deserializer, Serialize, Serializer};
pub use syntax::Edition;
pub use text_size::{TextRange, TextSize};
pub use vfs::FileId;
@@ -69,12 +68,11 @@ impl Span {
/// Spans represent a region of code, used by the IDE to be able link macro inputs and outputs
/// together. Positions in spans are relative to some [`SpanAnchor`] to make them more incremental
/// friendly.
-#[derive(Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub struct Span {
/// The text range of this span, relative to the anchor.
/// We need the anchor for incrementality, as storing absolute ranges will require
/// recomputation on every change in a file at all times.
- #[serde(serialize_with = "serialize_text_range", deserialize_with = "deserialize_text_range")]
pub range: TextRange,
/// The anchor this span is relative to.
pub anchor: SpanAnchor,
@@ -82,21 +80,6 @@ pub struct Span {
pub ctx: SyntaxContext,
}
-fn serialize_text_range<S>(range: &TextRange, serializer: S) -> Result<S::Ok, S::Error>
-where
- S: Serializer,
-{
- (u32::from(range.start()), u32::from(range.end())).serialize(serializer)
-}
-
-fn deserialize_text_range<'de, D>(deserializer: D) -> Result<TextRange, D::Error>
-where
- D: Deserializer<'de>,
-{
- let (start, end) = <(u32, u32)>::deserialize(deserializer)?;
- Ok(TextRange::new(TextSize::from(start), TextSize::from(end)))
-}
-
impl fmt::Debug for Span {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if f.alternate() {
@@ -129,7 +112,7 @@ impl fmt::Display for Span {
}
}
-#[derive(Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
+#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct SpanAnchor {
pub file_id: EditionedFileId,
pub ast_id: ErasedFileAstId,
@@ -143,7 +126,7 @@ impl fmt::Debug for SpanAnchor {
/// A [`FileId`] and [`Edition`] bundled up together.
/// The MSB is reserved for `HirFileId` encoding, more upper bits are used to then encode the edition.
-#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct EditionedFileId(u32);
impl fmt::Debug for EditionedFileId {