while j > i && lines[j - 1].trim().is_empty() {
j -= 1;
}
- return lines.index(&(i..j)).iter().map(|x| (*x).clone()).collect();
+ return lines[i..j].iter().map(|x| (*x).clone()).collect();
}
/// remove a "[ \t]*\*" block from each line, if possible
if can_trim {
lines.iter().map(|line| {
- line.index(&((i + 1)..line.len())).to_string()
+ (&line[i + 1..line.len()]).to_string()
}).collect()
} else {
lines
static ONLINERS: &'static [&'static str] = &["///!", "///", "//!", "//"];
for prefix in ONLINERS.iter() {
if comment.starts_with(*prefix) {
- return comment.index(&(prefix.len()..)).to_string();
+ return (&comment[prefix.len()..]).to_string();
}
}
if comment.starts_with("/*") {
- let lines = comment.index(&(3u..(comment.len() - 2u)))
+ let lines = comment[3u..comment.len() - 2u]
.lines_any()
.map(|s| s.to_string())
.collect::<Vec<String> >();
let line = rdr.read_one_line_comment();
debug!("{}", line);
// Doc comments are not put in comments.
- if is_doc_comment(line.index(&FullRange)) {
+ if is_doc_comment(&line[]) {
break;
}
lines.push(line);
fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<String> ,
s: String, col: CharPos) {
let len = s.len();
- let s1 = match all_whitespace(s.index(&FullRange), col) {
+ let s1 = match all_whitespace(&s[], col) {
Some(col) => {
if col < len {
- s.index(&(col..len)).to_string()
+ (&s[col..len]).to_string()
} else {
"".to_string()
}
rdr.bump();
rdr.bump();
}
- if is_block_doc_comment(curr_line.index(&FullRange)) {
+ if is_block_doc_comment(&curr_line[]) {
return
}
assert!(!curr_line.contains_char('\n'));