diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-05-09 13:27:24 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-05-11 20:36:44 -0700 |
| commit | ed4186446492e141a4dc37829dc9599133d00dd0 (patch) | |
| tree | b26e12beb4abead4e7dd3c0834c5e055a1fba478 /src/libsyntax/parse | |
| parent | f2f10bdc7a2f1d1501abb04f3625356c0c251d92 (diff) | |
| download | rust-ed4186446492e141a4dc37829dc9599133d00dd0.tar.gz rust-ed4186446492e141a4dc37829dc9599133d00dd0.zip | |
Warning police
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 4e29c3dcf18..acfd18c74de 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -202,15 +202,14 @@ fn all_whitespace(s: ~str, begin: uint, end: uint) -> bool { fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str], s: ~str, col: CharPos) { - let mut s1; - let len = str::len(s); + let len = s.len(); // FIXME #3961: Doing bytewise comparison and slicing with CharPos let col = col.to_uint(); - if all_whitespace(s, 0u, uint::min(len, col)) { + let s1 = if all_whitespace(s, 0, uint::min(len, col)) { if col < len { - s1 = str::slice(s, col, len).to_owned(); - } else { s1 = ~""; } - } else { s1 = s; } + str::slice(s, col, len).to_owned() + } else { ~"" } + } else { s }; debug!("pushing line: %s", s1); lines.push(s1); } |
