Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d3876e1

Browse files
committedJul 26, 2024
fix sorted json comments
1 parent 6e62af6 commit d3876e1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed
 

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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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)
Please sign in to comment.