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 {
989989 Excluded ,
990990}
991991
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+
9921001#[ derive( RustcEncodable , RustcDecodable , Debug , HashStable ) ]
9931002pub enum PatKind {
9941003 /// Represents a wildcard pattern (i.e., `_`).
Original file line number Diff line number Diff line change @@ -482,12 +482,9 @@ impl<'tcx> Constructor<'tcx> {
482482 // Get the right sign on the output:
483483 let ty = ty:: ParamEnv :: empty ( ) . and ( * ty) ;
484484 format ! (
485- "{}.. {}{}" ,
485+ "{}{}{}" ,
486486 ty:: Const :: from_bits( tcx, * lo, ty) ,
487- match range_end {
488- RangeEnd :: Included => "=" ,
489- RangeEnd :: Excluded => "" ,
490- } ,
487+ range_end,
491488 ty:: Const :: from_bits( tcx, * hi, ty) ,
492489 )
493490 }
Original file line number Diff line number Diff line change @@ -312,10 +312,7 @@ impl<'tcx> fmt::Display for Pat<'tcx> {
312312 }
313313 PatKind :: Range ( PatRange { lo, hi, end } ) => {
314314 write ! ( f, "{}" , lo) ?;
315- match end {
316- RangeEnd :: Included => write ! ( f, "..=" ) ?,
317- RangeEnd :: Excluded => write ! ( f, ".." ) ?,
318- }
315+ write ! ( f, "{}" , end) ?;
319316 write ! ( f, "{}" , hi)
320317 }
321318 PatKind :: Slice { ref prefix, ref slice, ref suffix } |
You can’t perform that action at this time.
0 commit comments