about summary refs log tree commit diff
path: root/src/libsyntax/print/pprust.rs
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2015-02-18 23:50:21 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2015-02-18 23:50:21 +1100
commitdfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5 (patch)
treee9c32f2e58b3462a23dd9c472d2f236640b78811 /src/libsyntax/print/pprust.rs
parent6c065fc8cb036785f61ff03e05c1563cbb2dd081 (diff)
parent47f91a9484eceef10536d4caac6ef578cd254567 (diff)
Manual merge of #22475 - alexcrichton:rollup, r=alexcrichton
 One windows bot failed spuriously.
Diffstat (limited to 'src/libsyntax/print/pprust.rs')
-rw-r--r--src/libsyntax/print/pprust.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 583095e1574..4b021f2434f 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -2761,15 +2761,13 @@ impl<'a> State<'a> {
             ast::LitStr(ref st, style) => self.print_string(&st, style),
             ast::LitByte(byte) => {
                 let mut res = String::from_str("b'");
-                ascii::escape_default(byte, |c| res.push(c as char));
+                res.extend(ascii::escape_default(byte).map(|c| c as char));
                 res.push('\'');
                 word(&mut self.s, &res[])
             }
             ast::LitChar(ch) => {
                 let mut res = String::from_str("'");
-                for c in ch.escape_default() {
-                    res.push(c);
-                }
+                res.extend(ch.escape_default());
                 res.push('\'');
                 word(&mut self.s, &res[])
             }
@@ -2809,8 +2807,8 @@ impl<'a> State<'a> {
             ast::LitBinary(ref v) => {
                 let mut escaped: String = String::new();
                 for &ch in &**v {
-                    ascii::escape_default(ch as u8,
-                                          |ch| escaped.push(ch as char));
+                    escaped.extend(ascii::escape_default(ch as u8)
+                                         .map(|c| c as char));
                 }
                 word(&mut self.s, &format!("b\"{}\"", escaped)[])
             }