Clarify use of format_args in Debug for Literal

This commit is contained in:
David Tolnay 2020-05-15 09:35:46 -07:00
parent 4c4b4c4ab4
commit bea2c59ea5
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -205,6 +205,7 @@ impl Clone for Literal {
impl fmt::Debug for Literal {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Literal")
// format the kind without quotes, as in `kind: Float`
.field("kind", &format_args!("{}", &self.debug_kind()))
.field("symbol", &self.symbol())
// format `Some("...")` on one line even in {:#?} mode