Skip to content

Commit d3eaf32

Browse files
committed
serialize: Convert statics to constants
1 parent edf8841 commit d3eaf32

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/libserialize/json.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,18 +360,16 @@ fn escape_char(writer: &mut io::Writer, v: char) -> Result<(), io::IoError> {
360360
}
361361

362362
fn spaces(wr: &mut io::Writer, mut n: uint) -> Result<(), io::IoError> {
363-
#[allow(non_uppercase_statics)]
364-
static len: uint = 16;
365-
#[allow(non_uppercase_statics)]
366-
static buf: [u8, ..len] = [b' ', ..len];
363+
const LEN: uint = 16;
364+
static BUF: [u8, ..LEN] = [b' ', ..LEN];
367365

368-
while n >= len {
369-
try!(wr.write(buf));
370-
n -= len;
366+
while n >= LEN {
367+
try!(wr.write(BUF));
368+
n -= LEN;
371369
}
372370

373371
if n > 0 {
374-
wr.write(buf[..n])
372+
wr.write(BUF[..n])
375373
} else {
376374
Ok(())
377375
}

0 commit comments

Comments
 (0)