aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-10-01 10:05:36 -0700
committerGitHub <noreply@github.com>2018-10-01 10:05:36 -0700
commit480457fdbd8b3a78e30d7cd4b7f045e38ff77740 (patch)
tree019d9a7a18b1512d099e8a8b704caad1b3c97b1f /src
parentf998fbe360b4ea37f27793a55831e988415b4b6d (diff)
parent2059589f5420bed3d490822fc9560db3c3a21515 (diff)
downloadmilf-rs-480457fdbd8b3a78e30d7cd4b7f045e38ff77740.tar.gz
milf-rs-480457fdbd8b3a78e30d7cd4b7f045e38ff77740.zip
Merge pull request #263 from Deewiant/final-quote-fix
Avoid panic on pretty string ending in single quote
Diffstat (limited to 'src')
-rw-r--r--src/ser.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ser.rs b/src/ser.rs
index 9d989db..9f36f59 100644
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -585,6 +585,10 @@ impl<'a> Serializer<'a> {
}
}
}
+ if can_be_pretty && found_singles > 0 && value.ends_with('\'') {
+ // We cannot escape the ending quote so we must use """
+ can_be_pretty = false;
+ }
if !can_be_pretty {
debug_assert!(ty != Type::OnelineTripple);
return Repr::Std(ty);