1
Fork 0

rustdoc: HTML escape const values

This commit is contained in:
Oliver Middleton 2020-01-05 23:19:42 +00:00
parent cd8377d37e
commit e2305d0055
4 changed files with 26 additions and 5 deletions

View file

@ -2279,7 +2279,7 @@ fn item_constant(w: &mut Buffer, cx: &Context, it: &clean::Item, c: &clean::Cons
);
if c.value.is_some() || c.is_literal {
write!(w, " = {expr};", expr = c.expr);
write!(w, " = {expr};", expr = Escape(&c.expr));
} else {
write!(w, ";");
}
@ -2292,7 +2292,7 @@ fn item_constant(w: &mut Buffer, cx: &Context, it: &clean::Item, c: &clean::Cons
if value_lowercase != expr_lowercase
&& value_lowercase.trim_end_matches("i32") != expr_lowercase
{
write!(w, " // {value}", value = value);
write!(w, " // {value}", value = Escape(value));
}
}
}