mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-25 03:04:13 +03:00
Merge pull request #338 from AleoHQ/refactor/span
remove unused span methods
This commit is contained in:
commit
377c416941
@ -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