Skip to content

Commit ae0b21a

Browse files
committed
fix sorted json comments
1 parent de0ac94 commit ae0b21a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/librustdoc/html/render/sorted_json.rs

+3-1
Original file line numberDiff line numberDiff 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)]
6668
pub(crate) struct EscapedJson(SortedJson);

src/librustdoc/html/render/sorted_json/tests.rs

+2-2
Original file line numberDiff line numberDiff 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]
2322
fn 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]
6565
fn number() {
6666
let json = SortedJson::serialize(3);

0 commit comments

Comments
 (0)