Merge pull request #338 from AleoHQ/refactor/span

remove unused span methods
This commit is contained in:
Howard Wu 2020-09-02 21:54:33 -07:00 committed by GitHub
commit 377c416941
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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(),
}
}
}