diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-10-06 16:33:56 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-10-09 09:44:51 -0700 |
| commit | d3eaf3290048a9da680b2c13b158fd6aeb307902 (patch) | |
| tree | ca215fb1def24adfc2e6fa21a9595dc252b7e320 | |
| parent | edf88416426d82d0099fc888e443bf21feeb1f04 (diff) | |
| download | rust-d3eaf3290048a9da680b2c13b158fd6aeb307902.tar.gz rust-d3eaf3290048a9da680b2c13b158fd6aeb307902.zip | |
serialize: Convert statics to constants
| -rw-r--r-- | src/libserialize/json.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index a9ac5ec3ab4..5d9211caac1 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -360,18 +360,16 @@ fn escape_char(writer: &mut io::Writer, v: char) -> Result<(), io::IoError> { } fn spaces(wr: &mut io::Writer, mut n: uint) -> Result<(), io::IoError> { - #[allow(non_uppercase_statics)] - static len: uint = 16; - #[allow(non_uppercase_statics)] - static buf: [u8, ..len] = [b' ', ..len]; + const LEN: uint = 16; + static BUF: [u8, ..LEN] = [b' ', ..LEN]; - while n >= len { - try!(wr.write(buf)); - n -= len; + while n >= LEN { + try!(wr.write(BUF)); + n -= LEN; } if n > 0 { - wr.write(buf[..n]) + wr.write(BUF[..n]) } else { Ok(()) } |
