about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <arielb1@mail.tau.ac.il>2017-08-29 21:41:04 +0000
committerGitHub <noreply@github.com>2017-08-29 21:41:04 +0000
commitbe0ac0124c992f22d69df0b4d9e27d50a0130575 (patch)
tree11a1116831ee2df7ac555f88bc2ab29ebc1a60bc
parenta88757e0cdae8b24887e9404df20d3a265fc1c7c (diff)
parent4312ed765a5f3354f3214fb3b214bff64ae8ccbf (diff)
downloadrust-be0ac0124c992f22d69df0b4d9e27d50a0130575.tar.gz
rust-be0ac0124c992f22d69df0b4d9e27d50a0130575.zip
Rollup merge of #44158 - dtolnay:zero48, r=sfackler
Use a byte literal ASCII 0 instead of its decimal value

@SimonSapin noticed this in https://github.com/dtolnay/itoa/pull/8.
-rw-r--r--src/libcore/fmt/num.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs
index 4ca303dee43..8ea388fddf8 100644
--- a/src/libcore/fmt/num.rs
+++ b/src/libcore/fmt/num.rs
@@ -242,7 +242,7 @@ macro_rules! impl_Display {
                 // decode last 1 or 2 chars
                 if n < 10 {
                     curr -= 1;
-                    *buf_ptr.offset(curr) = (n as u8) + 48;
+                    *buf_ptr.offset(curr) = (n as u8) + b'0';
                 } else {
                     let d1 = n << 1;
                     curr -= 2;