Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Update util.rs #33

Merged
merged 1 commit into from
Mar 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
//! Pippin utility functions

use std::cmp;
use std::str::from_utf8;
use std::fmt;
use std::fmt::Write;

/// "trim" applied to generic arrays: while the last byte is pat, remove it.
///
Expand Down Expand Up @@ -47,9 +47,7 @@ impl<'a> fmt::Display for ByteFormatter<'a> {
} else if *b == b'\'' {
try!(write!(f, "\\\'"));
} else if *b >= b' ' && *b <= b'~' {
// #0030: this is a horrible way to write a char!
let v = vec![*b];
try!(write!(f, "{}", from_utf8(&v).unwrap()));
try!(f.write_char(*b as char));
} else {
try!(write!(f, "\\x{:02x}", b));
}
Expand Down