diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-06-28 14:04:13 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-06-30 09:19:02 -0700 |
| commit | 8fe6fc11de4d6bfbffd8b961f5f1f24a338601d5 (patch) | |
| tree | dad32e62eb08d71c621bfb573c57f89c2aae6814 /src/libsyntax/print/pprust.rs | |
| parent | 2b3569a1b39097481877cf8fee538c78099c5acd (diff) | |
| download | rust-8fe6fc11de4d6bfbffd8b961f5f1f24a338601d5.tar.gz rust-8fe6fc11de4d6bfbffd8b961f5f1f24a338601d5.zip | |
Change char::escape_{default,unicode} to take callbacks instead of allocating
strings
Diffstat (limited to 'src/libsyntax/print/pprust.rs')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 978561eaa67..5e685d85f95 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -27,7 +27,6 @@ use print::pp::{breaks, consistent, inconsistent, eof}; use print::pp; use print::pprust; -use std::char; use std::io; use std::u64; use std::uint; @@ -2016,7 +2015,12 @@ pub fn print_literal(s: @ps, lit: @ast::lit) { match lit.node { ast::lit_str(st) => print_string(s, st), ast::lit_int(ch, ast::ty_char) => { - word(s.s, ~"'" + char::escape_default(ch as char) + "'"); + let mut res = ~"'"; + do (ch as char).escape_default |c| { + res.push_char(c); + } + res.push_char('\''); + word(s.s, res); } ast::lit_int(i, t) => { if i < 0_i64 { |
