serialize: Convert statics to constants
This commit is contained in:
parent
edf8841642
commit
d3eaf32900
1 changed files with 6 additions and 8 deletions
|
@ -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> {
|
fn spaces(wr: &mut io::Writer, mut n: uint) -> Result<(), io::IoError> {
|
||||||
#[allow(non_uppercase_statics)]
|
const LEN: uint = 16;
|
||||||
static len: uint = 16;
|
static BUF: [u8, ..LEN] = [b' ', ..LEN];
|
||||||
#[allow(non_uppercase_statics)]
|
|
||||||
static buf: [u8, ..len] = [b' ', ..len];
|
|
||||||
|
|
||||||
while n >= len {
|
while n >= LEN {
|
||||||
try!(wr.write(buf));
|
try!(wr.write(BUF));
|
||||||
n -= len;
|
n -= LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
wr.write(buf[..n])
|
wr.write(BUF[..n])
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue