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() {
569
569
Specifies which edition is used by the parser.
570
570
571
571
- ** Default value** : ` "2015" `
572
- - ** Possible values** : ` "2015" ` , ` "2018" `
572
+ - ** Possible values** : ` "2015" ` , ` "2018" ` , ` "2021" `
573
573
- ** Stable** : Yes
574
574
575
575
Rustfmt 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 {
343
343
#[ doc_hint = "2018" ]
344
344
/// Edition 2018.
345
345
Edition2018 ,
346
+ #[ value = "2021" ]
347
+ #[ doc_hint = "2021" ]
348
+ /// Edition 2021.
349
+ Edition2021 ,
346
350
}
347
351
348
352
impl Default for Edition {
@@ -356,10 +360,17 @@ impl From<Edition> for rustc_span::edition::Edition {
356
360
match edition {
357
361
Edition :: Edition2015 => Self :: Edition2015 ,
358
362
Edition :: Edition2018 => Self :: Edition2018 ,
363
+ Edition :: Edition2021 => Self :: Edition2021 ,
359
364
}
360
365
}
361
366
}
362
367
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
+
363
374
/// Controls how rustfmt should handle leading pipes on match arms.
364
375
#[ config_type]
365
376
pub enum MatchArmLeadingPipe {
Original file line number Diff line number Diff line change @@ -333,7 +333,7 @@ impl UseTree {
333
333
} ;
334
334
335
335
let leading_modsep =
336
- context. config . edition ( ) = = Edition :: Edition2018 && a. prefix . is_global ( ) ;
336
+ context. config . edition ( ) > = Edition :: Edition2018 && a. prefix . is_global ( ) ;
337
337
338
338
let mut modsep = leading_modsep;
339
339
You can’t perform that action at this time.
0 commit comments