File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -2315,6 +2315,10 @@ impl ToJson for bool {
2315
2315
fn to_json( & self ) -> Json { Boolean ( * self ) }
2316
2316
}
2317
2317
2318
+ impl ToJson for str {
2319
+ fn to_json( & self ) -> Json { String ( self . into_string( ) ) }
2320
+ }
2321
+
2318
2322
impl ToJson for string:: String {
2319
2323
fn to_json( & self ) -> Json { String ( ( * self ) . clone( ) ) }
2320
2324
}
@@ -3714,7 +3718,8 @@ mod tests {
3714
3718
assert_eq!( f64 :: NAN . to_json( ) , Null ) ;
3715
3719
assert_eq!( true . to_json( ) , Boolean ( true ) ) ;
3716
3720
assert_eq!( false . to_json( ) , Boolean ( false ) ) ;
3717
- assert_eq!( "abc" . to_string( ) . to_json( ) , String ( "abc" . to_string( ) ) ) ;
3721
+ assert_eq!( "abc" . to_json( ) , String ( "abc" . into_string( ) ) ) ;
3722
+ assert_eq!( "abc" . into_string( ) . to_json( ) , String ( "abc" . into_string( ) ) ) ;
3718
3723
assert_eq!( ( 1 u, 2 u) . to_json( ) , list2) ;
3719
3724
assert_eq!( ( 1 u, 2 u, 3 u) . to_json( ) , list3) ;
3720
3725
assert_eq!( [ 1 u, 2 ] . to_json( ) , list2) ;
You can’t perform that action at this time.
0 commit comments