File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -569,7 +569,7 @@ fn main() {
569569Specifies which edition is used by the parser.
570570
571571- ** Default value** : ` "2015" `
572- - ** Possible values** : ` "2015" ` , ` "2018" `
572+ - ** Possible values** : ` "2015" ` , ` "2018" ` , ` "2021" `
573573- ** Stable** : Yes
574574
575575Rustfmt is able to pick up the edition used by reading the ` Cargo.toml ` file if executed
Original file line number Diff line number Diff line change @@ -343,6 +343,10 @@ pub enum Edition {
343343 #[ doc_hint = "2018" ]
344344 /// Edition 2018.
345345 Edition2018 ,
346+ #[ value = "2021" ]
347+ #[ doc_hint = "2021" ]
348+ /// Edition 2021.
349+ Edition2021 ,
346350}
347351
348352impl Default for Edition {
@@ -356,10 +360,17 @@ impl From<Edition> for rustc_span::edition::Edition {
356360 match edition {
357361 Edition :: Edition2015 => Self :: Edition2015 ,
358362 Edition :: Edition2018 => Self :: Edition2018 ,
363+ Edition :: Edition2021 => Self :: Edition2021 ,
359364 }
360365 }
361366}
362367
368+ impl PartialOrd for Edition {
369+ fn partial_cmp ( & self , other : & Edition ) -> Option < std:: cmp:: Ordering > {
370+ rustc_span:: edition:: Edition :: partial_cmp ( & ( * self ) . into ( ) , & ( * other) . into ( ) )
371+ }
372+ }
373+
363374/// Controls how rustfmt should handle leading pipes on match arms.
364375#[ config_type]
365376pub enum MatchArmLeadingPipe {
Original file line number Diff line number Diff line change @@ -333,7 +333,7 @@ impl UseTree {
333333 } ;
334334
335335 let leading_modsep =
336- context. config . edition ( ) = = Edition :: Edition2018 && a. prefix . is_global ( ) ;
336+ context. config . edition ( ) > = Edition :: Edition2018 && a. prefix . is_global ( ) ;
337337
338338 let mut modsep = leading_modsep;
339339
You can’t perform that action at this time.
0 commit comments