Skip to content

Commit 0392052

Browse files
committed
fix value string display
1 parent be9f0b5 commit 0392052

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/value.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ impl<'a> Display for Value<'a> {
6969
}
7070
Value::Number(ref v) => write!(f, "{}", v),
7171
Value::String(ref v) => {
72-
write!(f, "\"")?;
73-
write!(f, "{v}")?;
74-
write!(f, "\"")
72+
write!(f, "{:?}", v)
7573
}
7674
Value::Array(ref vs) => {
7775
let mut first = true;

tests/it/functions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ fn test_to_string() {
675675
let mut buf: Vec<u8> = Vec::new();
676676
for (s, expect) in sources {
677677
let value = parse_value(s.as_bytes()).unwrap();
678+
assert_eq!(format!("{}", value), expect);
678679
value.write_to_vec(&mut buf);
679680
let res = to_string(&buf);
680681
assert_eq!(res, expect);

0 commit comments

Comments
 (0)