@@ -13,59 +13,10 @@ pub use self::{
13
13
map:: { RealSpanMap , SpanMap } ,
14
14
} ;
15
15
16
- pub use syntax:: { TextRange , TextSize } ;
16
+ pub use syntax:: Edition ;
17
+ pub use text_size:: { TextRange , TextSize } ;
17
18
pub use vfs:: FileId ;
18
19
19
- #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
20
- pub enum Edition {
21
- Edition2015 ,
22
- Edition2018 ,
23
- Edition2021 ,
24
- Edition2024 ,
25
- }
26
-
27
- impl Edition {
28
- pub const CURRENT : Edition = Edition :: Edition2021 ;
29
- pub const DEFAULT : Edition = Edition :: Edition2015 ;
30
- }
31
-
32
- #[ derive( Debug ) ]
33
- pub struct ParseEditionError {
34
- invalid_input : String ,
35
- }
36
-
37
- impl std:: error:: Error for ParseEditionError { }
38
- impl fmt:: Display for ParseEditionError {
39
- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
40
- write ! ( f, "invalid edition: {:?}" , self . invalid_input)
41
- }
42
- }
43
-
44
- impl std:: str:: FromStr for Edition {
45
- type Err = ParseEditionError ;
46
-
47
- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
48
- let res = match s {
49
- "2015" => Edition :: Edition2015 ,
50
- "2018" => Edition :: Edition2018 ,
51
- "2021" => Edition :: Edition2021 ,
52
- "2024" => Edition :: Edition2024 ,
53
- _ => return Err ( ParseEditionError { invalid_input : s. to_owned ( ) } ) ,
54
- } ;
55
- Ok ( res)
56
- }
57
- }
58
-
59
- impl fmt:: Display for Edition {
60
- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
61
- f. write_str ( match self {
62
- Edition :: Edition2015 => "2015" ,
63
- Edition :: Edition2018 => "2018" ,
64
- Edition :: Edition2021 => "2021" ,
65
- Edition :: Edition2024 => "2024" ,
66
- } )
67
- }
68
- }
69
20
#[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash ) ]
70
21
pub struct FilePosition {
71
22
pub file_id : FileId ,
0 commit comments