Skip to content

Commit b543057

Browse files
aneubeckHendrik van Antwerpen
authored andcommitted
linter
1 parent d94a195 commit b543057

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

crates/bpe-openai/src/lib.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ use std::sync::LazyLock;
22

33
use bpe::byte_pair_encoding::BytePairEncoding;
44
use either::Either;
5-
use regex_automata::{meta::{BuildError, Regex}, util::captures::Captures, Anchored, Input};
5+
use regex_automata::{
6+
meta::{BuildError, Regex},
7+
util::captures::Captures,
8+
Anchored, Input,
9+
};
610

711
// Note: Below we rewrite the negative look-ahead with a positive pseudo look-ahead.
812
// The look-ahead character is dropped from the match by the Pretokenizer iterator.
@@ -121,7 +125,10 @@ impl<'a> Iterator for SpecialRegexp<'a> {
121125
let start = self.last;
122126
let mut end = self.last + m.range().end;
123127
if m.pattern() == 1.into() {
124-
let last = self.input[start..end].chars().next_back().expect("Expected at least a look-ahead character!");
128+
let last = self.input[start..end]
129+
.chars()
130+
.next_back()
131+
.expect("Expected at least a look-ahead character!");
125132
end -= last.len_utf8();
126133
assert_ne!(end, start, "a look-ahead pattern must ALWAYS consume at least one character excluding the look-ahead character!");
127134
}

0 commit comments

Comments
 (0)