remove unused span methods

This commit is contained in:
collin 2020-09-02 18:52:40 -07:00
parent 6fc3393f5c
commit e6abe82935

View File

@ -45,40 +45,3 @@ impl<'ast> From<AstSpan<'ast>> for Span {
}
}
}
pub fn find_line_start(pos: &Position) -> usize {
let input = pos.line_of();
if input.is_empty() {
return 0;
};
// Position's pos is always a UTF-8 border.
let start = input
.char_indices()
.rev()
.skip_while(|&(i, _)| i >= pos.pos())
.find(|&(_, c)| c == '\n');
match start {
Some((i, _)) => i,
None => 0,
}
}
pub fn find_line_end(pos: &Position) -> usize {
let input = pos.line_of();
if input.is_empty() {
0
} else if pos.pos() == input.len() - 1 {
input.len()
} else {
// Position's pos is always a UTF-8 border.
let end = input
.char_indices()
.skip_while(|&(i, _)| i < pos.pos())
.find(|&(_, c)| c == '\n');
match end {
Some((i, _)) => i,
None => input.len(),
}
}
}