diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-04-16 22:23:57 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-04-16 22:23:57 +0200 |
| commit | c5b3f8ee98203191d83d3cfca39bb0f35ee6efc2 (patch) | |
| tree | d41733b9f532a1b4ad0089761315ef69ba413e82 /src/source.rs | |
| parent | 2db4b603db7684db7105d7ed627883b5cef6d497 (diff) | |
Switch to `unscanny`
Diffstat (limited to 'src/source.rs')
| -rw-r--r-- | src/source.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/source.rs b/src/source.rs index 9f2a0140..37aa96ca 100644 --- a/src/source.rs +++ b/src/source.rs @@ -6,9 +6,11 @@ use std::ops::Range; use std::path::{Path, PathBuf}; use std::sync::Arc; +use unscanny::Scanner; + use crate::diag::TypResult; use crate::loading::{FileHash, Loader}; -use crate::parse::{is_newline, parse, Reparser, Scanner}; +use crate::parse::{is_newline, parse, Reparser}; use crate::syntax::ast::Markup; use crate::syntax::{self, Category, GreenNode, RedNode}; use crate::util::{PathExt, StrExt}; @@ -382,12 +384,12 @@ impl Line { let mut utf16_idx = utf16_offset; std::iter::from_fn(move || { - s.eat_until(|c| { + s.eat_until(|c: char| { utf16_idx += c.len_utf16(); is_newline(c) }); - if s.eof() { + if s.done() { return None; } @@ -396,7 +398,7 @@ impl Line { } Some(Line { - byte_idx: byte_offset + s.index(), + byte_idx: byte_offset + s.cursor(), utf16_idx, }) }) |
