From 5f3ca811f09dcf6f09fb9b60fcd2664d06762f39 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 28 Oct 2020 20:25:06 +0000 Subject: No need to escape underscores in pretty-printing --- dhall/src/syntax/text/printer.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'dhall/src') diff --git a/dhall/src/syntax/text/printer.rs b/dhall/src/syntax/text/printer.rs index 0c2eb2e..4b7b8b8 100644 --- a/dhall/src/syntax/text/printer.rs +++ b/dhall/src/syntax/text/printer.rs @@ -156,7 +156,9 @@ fn fmt_label(label: &Label, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { }; if s.is_empty() { write!(f, "``") - } else if !is_reserved && s.chars().all(|c| c.is_ascii_alphanumeric()) { + } else if !is_reserved + && s.chars().all(|c| c.is_ascii_alphanumeric() || c == '_') + { write!(f, "{}", s) } else { write!(f, "`{}`", s) -- cgit v1.2.3