File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed
librustc_mir/hair/pattern Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -989,6 +989,15 @@ pub enum RangeEnd {
989
989
Excluded ,
990
990
}
991
991
992
+ impl fmt:: Display for RangeEnd {
993
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
994
+ f. write_str ( match self {
995
+ RangeEnd :: Included => "..=" ,
996
+ RangeEnd :: Excluded => ".." ,
997
+ } )
998
+ }
999
+ }
1000
+
992
1001
#[ derive( RustcEncodable , RustcDecodable , Debug , HashStable ) ]
993
1002
pub enum PatKind {
994
1003
/// Represents a wildcard pattern (i.e., `_`).
Original file line number Diff line number Diff line change @@ -482,12 +482,9 @@ impl<'tcx> Constructor<'tcx> {
482
482
// Get the right sign on the output:
483
483
let ty = ty:: ParamEnv :: empty ( ) . and ( * ty) ;
484
484
format ! (
485
- "{}.. {}{}" ,
485
+ "{}{}{}" ,
486
486
ty:: Const :: from_bits( tcx, * lo, ty) ,
487
- match range_end {
488
- RangeEnd :: Included => "=" ,
489
- RangeEnd :: Excluded => "" ,
490
- } ,
487
+ range_end,
491
488
ty:: Const :: from_bits( tcx, * hi, ty) ,
492
489
)
493
490
}
Original file line number Diff line number Diff line change @@ -312,10 +312,7 @@ impl<'tcx> fmt::Display for Pat<'tcx> {
312
312
}
313
313
PatKind :: Range ( PatRange { lo, hi, end } ) => {
314
314
write ! ( f, "{}" , lo) ?;
315
- match end {
316
- RangeEnd :: Included => write ! ( f, "..=" ) ?,
317
- RangeEnd :: Excluded => write ! ( f, ".." ) ?,
318
- }
315
+ write ! ( f, "{}" , end) ?;
319
316
write ! ( f, "{}" , hi)
320
317
}
321
318
PatKind :: Slice { ref prefix, ref slice, ref suffix } |
You can’t perform that action at this time.
0 commit comments