File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
src/librustdoc/html/render Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,9 @@ impl From<SortedJson> for Value {
6060
6161/// For use in JSON.parse('{...}').
6262///
63- /// JSON.parse supposedly loads faster than raw JS source,
63+ /// Assumes we are going to be wrapped in single quoted strings.
64+ ///
65+ /// JSON.parse loads faster than raw JS source,
6466/// so this is used for large objects.
6567#[ derive( Debug , Clone , Serialize , Deserialize ) ]
6668pub ( crate ) struct EscapedJson ( SortedJson ) ;
Original file line number Diff line number Diff line change @@ -17,8 +17,7 @@ fn check(json: SortedJson, serialized: &str) {
1717 assert_eq ! ( serde_json:: to_string( & json) . unwrap( ) , serialized) ;
1818}
1919
20- // Test this basic are needed because we are testing that our Display impl + serialize impl don't
21- // nest everything in extra level of string. We also are testing round trip.
20+ // Make sure there is no extra level of string, plus number of escapes.
2221#[ test]
2322fn escape_json_number ( ) {
2423 let json = SortedJson :: serialize ( 3 ) ;
@@ -61,6 +60,7 @@ fn escape_json_string_escaped_escaped() {
6160 assert_eq ! ( format!( "{json}" ) , r#""he\\\\\\\\\\\"llo""# ) ;
6261}
6362
63+ // Testing round trip + making sure there is no extra level of string
6464#[ test]
6565fn number ( ) {
6666 let json = SortedJson :: serialize ( 3 ) ;
You can’t perform that action at this time.
0 commit comments