@@ -20,7 +20,6 @@ pub use self::{
2020 map:: { RealSpanMap , SpanMap } ,
2121} ;
2222
23- use serde:: { Deserialize , Deserializer , Serialize , Serializer } ;
2423pub use syntax:: Edition ;
2524pub use text_size:: { TextRange , TextSize } ;
2625pub use vfs:: FileId ;
@@ -69,34 +68,18 @@ impl Span {
6968/// Spans represent a region of code, used by the IDE to be able link macro inputs and outputs
7069/// together. Positions in spans are relative to some [`SpanAnchor`] to make them more incremental
7170/// friendly.
72- #[ derive( Clone , Copy , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
71+ #[ derive( Clone , Copy , PartialEq , Eq , Hash ) ]
7372pub struct Span {
7473 /// The text range of this span, relative to the anchor.
7574 /// We need the anchor for incrementality, as storing absolute ranges will require
7675 /// recomputation on every change in a file at all times.
77- #[ serde( serialize_with = "serialize_text_range" , deserialize_with = "deserialize_text_range" ) ]
7876 pub range : TextRange ,
7977 /// The anchor this span is relative to.
8078 pub anchor : SpanAnchor ,
8179 /// The syntax context of the span.
8280 pub ctx : SyntaxContext ,
8381}
8482
85- fn serialize_text_range < S > ( range : & TextRange , serializer : S ) -> Result < S :: Ok , S :: Error >
86- where
87- S : Serializer ,
88- {
89- ( u32:: from ( range. start ( ) ) , u32:: from ( range. end ( ) ) ) . serialize ( serializer)
90- }
91-
92- fn deserialize_text_range < ' de , D > ( deserializer : D ) -> Result < TextRange , D :: Error >
93- where
94- D : Deserializer < ' de > ,
95- {
96- let ( start, end) = <( u32 , u32 ) >:: deserialize ( deserializer) ?;
97- Ok ( TextRange :: new ( TextSize :: from ( start) , TextSize :: from ( end) ) )
98- }
99-
10083impl fmt:: Debug for Span {
10184 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
10285 if f. alternate ( ) {
@@ -129,7 +112,7 @@ impl fmt::Display for Span {
129112 }
130113}
131114
132- #[ derive( Copy , Clone , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
115+ #[ derive( Copy , Clone , PartialEq , Eq , Hash ) ]
133116pub struct SpanAnchor {
134117 pub file_id : EditionedFileId ,
135118 pub ast_id : ErasedFileAstId ,
@@ -143,7 +126,7 @@ impl fmt::Debug for SpanAnchor {
143126
144127/// A [`FileId`] and [`Edition`] bundled up together.
145128/// The MSB is reserved for `HirFileId` encoding, more upper bits are used to then encode the edition.
146- #[ derive( Clone , Copy , PartialEq , Eq , Hash , PartialOrd , Ord , Serialize , Deserialize ) ]
129+ #[ derive( Clone , Copy , PartialEq , Eq , Hash , PartialOrd , Ord ) ]
147130pub struct EditionedFileId ( u32 ) ;
148131
149132impl fmt:: Debug for EditionedFileId {
0 commit comments