From bba1de754358d29f7f214374f54f28dbc368f47a Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 22 Apr 2021 15:07:54 +0200 Subject: [PATCH] Simplify loop --- instant-segment/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instant-segment/src/lib.rs b/instant-segment/src/lib.rs index e2e3184..46ae92c 100644 --- a/instant-segment/src/lib.rs +++ b/instant-segment/src/lib.rs @@ -73,7 +73,7 @@ impl Segmenter { pub fn score_sentence<'a>(&self, mut words: impl Iterator) -> Option { let mut prev = words.next()?; let mut score = self.score(prev, None); - while let Some(word) = words.next() { + for word in words { score += self.score(word, Some(prev)); prev = word; }