Skip to content

Commit 3bfce0f

Browse files
committed
Avoid .iter() in loops
1 parent 1e57919 commit 3bfce0f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/nfa.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,13 @@ impl<T> NFA<T> {
274274
fn process_char(&self, threads: Vec<Thread>, char: char, pos: usize) -> Vec<Thread> {
275275
let mut returned = Vec::with_capacity(threads.len());
276276

277-
for mut thread in threads.into_iter() {
277+
for mut thread in threads {
278278
let current_state = self.get(thread.state);
279279

280280
let mut count = 0;
281281
let mut found_state = 0;
282282

283-
for &index in current_state.next_states.iter() {
283+
for &index in &current_state.next_states {
284284
let state = &self.states[index];
285285

286286
if state.chars.matches(char) {
@@ -296,7 +296,7 @@ impl<T> NFA<T> {
296296
continue;
297297
}
298298

299-
for &index in current_state.next_states.iter() {
299+
for &index in &current_state.next_states {
300300
let state = &self.states[index];
301301
if state.chars.matches(char) {
302302
let mut thread = fork_thread(&thread, state);
@@ -322,7 +322,7 @@ impl<T> NFA<T> {
322322
{
323323
let state = self.get(index);
324324

325-
for &index in state.next_states.iter() {
325+
for &index in &state.next_states {
326326
let state = self.get(index);
327327
if state.chars == chars {
328328
return index;

0 commit comments

Comments
 (0)