From d15448b359970bfadefe8a6f612cc519799e0510 Mon Sep 17 00:00:00 2001 From: Martin Larralde <martin.larralde@embl.de> Date: Thu, 20 Jun 2024 13:18:10 +0200 Subject: [PATCH] Avoid using option type in default `Maximum::argmax` implementation --- lightmotif/src/pli/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lightmotif/src/pli/mod.rs b/lightmotif/src/pli/mod.rs index 5c01662..8df645e 100644 --- a/lightmotif/src/pli/mod.rs +++ b/lightmotif/src/pli/mod.rs @@ -141,14 +141,14 @@ pub trait Maximum<T: MatrixElement + PartialOrd, C: StrictlyPositive> { let mut best_row = 0; let mut best_col = 0; - let mut best_score = None; + let mut best_score = scores[0]; for (i, row) in scores.matrix().iter().enumerate() { for j in 0..C::USIZE { - if best_score.as_ref().map(|s| &row[j] >= s).unwrap_or(true) { + if row[j] >= best_score { best_row = i; best_col = j; - best_score = Some(row[j]); + best_score = row[j]; } } } -- GitLab