File tree 2 files changed +5
-3
lines changed
src/librustdoc/html/render
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 {
60
60
61
61
/// For use in JSON.parse('{...}').
62
62
///
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,
64
66
/// so this is used for large objects.
65
67
#[ derive( Debug , Clone , Serialize , Deserialize ) ]
66
68
pub ( crate ) struct EscapedJson ( SortedJson ) ;
Original file line number Diff line number Diff line change @@ -17,8 +17,7 @@ fn check(json: SortedJson, serialized: &str) {
17
17
assert_eq ! ( serde_json:: to_string( & json) . unwrap( ) , serialized) ;
18
18
}
19
19
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.
22
21
#[ test]
23
22
fn escape_json_number ( ) {
24
23
let json = SortedJson :: serialize ( 3 ) ;
@@ -61,6 +60,7 @@ fn escape_json_string_escaped_escaped() {
61
60
assert_eq ! ( format!( "{json}" ) , r#""he\\\\\\\\\\\"llo""# ) ;
62
61
}
63
62
63
+ // Testing round trip + making sure there is no extra level of string
64
64
#[ test]
65
65
fn number ( ) {
66
66
let json = SortedJson :: serialize ( 3 ) ;
You can’t perform that action at this time.
0 commit comments