@@ -2949,52 +2949,39 @@ impl SpecToString for i8 {
2949
2949
}
2950
2950
}
2951
2951
2952
- // Generic/generated code can sometimes have multiple, nested references
2953
- // for strings, including `&&&str`s that would never be written
2954
- // by hand. This macro generates twelve layers of nested `&`-impl
2955
- // for primitive strings.
2956
- #[ cfg( not( no_global_oom_handling) ) ]
2957
- macro_rules! to_string_str_wrap_in_ref {
2958
- { x $( $x: ident) * } => {
2959
- & to_string_str_wrap_in_ref! { $( $x) * }
2960
- } ;
2961
- { } => { str } ;
2962
- }
2963
- #[ cfg( not( no_global_oom_handling) ) ]
2964
- macro_rules! to_string_expr_wrap_in_deref {
2965
- { $self: expr ; x $( $x: ident) * } => {
2966
- * ( to_string_expr_wrap_in_deref! { $self ; $( $x) * } )
2967
- } ;
2968
- { $self: expr ; } => { $self } ;
2969
- }
2970
2952
#[ cfg( not( no_global_oom_handling) ) ]
2971
2953
macro_rules! to_string_str {
2972
- { $( $( $x : ident ) * ) ,+ } => {
2954
+ { $( $type : ty , ) * } => {
2973
2955
$(
2974
- impl SpecToString for to_string_str_wrap_in_ref! ( $ ( $x ) * ) {
2956
+ impl SpecToString for $type {
2975
2957
#[ inline]
2976
2958
fn spec_to_string( & self ) -> String {
2977
- String :: from( to_string_expr_wrap_in_deref!( self ; $( $x) * ) )
2959
+ let s: & str = self ;
2960
+ String :: from( s)
2978
2961
}
2979
2962
}
2980
- ) +
2963
+ ) *
2981
2964
} ;
2982
2965
}
2983
2966
2984
2967
#[ cfg( not( no_global_oom_handling) ) ]
2985
2968
to_string_str ! {
2986
- x x x x x x x x x x x x,
2987
- x x x x x x x x x x x,
2988
- x x x x x x x x x x,
2989
- x x x x x x x x x,
2990
- x x x x x x x x,
2991
- x x x x x x x,
2992
- x x x x x x,
2993
- x x x x x,
2994
- x x x x,
2995
- x x x,
2996
- x x,
2997
- x,
2969
+ // Generic/generated code can sometimes have multiple, nested references
2970
+ // for strings, including `&&&str`s that would never be written
2971
+ // by hand.
2972
+ &&&&&&&&&&&&str ,
2973
+ &&&&&&&&&&& str ,
2974
+ &&&&&&&&&&str ,
2975
+ &&&&&&&&& str ,
2976
+ &&&&&&&&str ,
2977
+ &&&&&&& str ,
2978
+ &&&&&&str ,
2979
+ &&&&& str ,
2980
+ &&&&str ,
2981
+ &&& str ,
2982
+ &&str ,
2983
+ & str ,
2984
+ str ,
2998
2985
}
2999
2986
3000
2987
#[ cfg( not( no_global_oom_handling) ) ]
0 commit comments