From cfca1c04fa1c0b0948c3eb046d1113788e639a01 Mon Sep 17 00:00:00 2001 From: Sean McArthur <sean.monstar@gmail.com> Date: Thu, 17 Aug 2017 10:28:06 -0700 Subject: [PATCH] print space normally in Debug for Bytes (#155) --- src/debug.rs | 4 ++-- tests/test_debug.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/debug.rs b/src/debug.rs index abead05..f8b830a 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -27,8 +27,8 @@ impl<'a> fmt::Debug for BsDebug<'a> { try!(write!(fmt, "\\{}", c as char)); } else if c == b'\0' { try!(write!(fmt, "\\0")); - // ASCII printable except space - } else if c > 0x20 && c < 0x7f { + // ASCII printable + } else if c >= 0x20 && c < 0x7f { try!(write!(fmt, "{}", c as char)); } else { try!(write!(fmt, "\\x{:02x}", c)); diff --git a/tests/test_debug.rs b/tests/test_debug.rs index eec7bca..9945a28 100644 --- a/tests/test_debug.rs +++ b/tests/test_debug.rs @@ -11,7 +11,7 @@ fn fmt() { \\x08\\t\\n\\x0b\\x0c\\r\\x0e\\x0f\ \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\ \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f\ - \\x20!\\\"#$%&'()*+,-./0123456789:;<=>?\ + \x20!\\\"#$%&'()*+,-./0123456789:;<=>?\ @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_\ `abcdefghijklmnopqrstuvwxyz{|}~\\x7f\ \\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\ -- GitLab