mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-25 11:12:48 +03:00
remove unused span methods
This commit is contained in:
parent
6fc3393f5c
commit
e6abe82935
@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user