refactor: idiomatic find in primary_code (clippy)

This commit is contained in:
2026-05-18 16:22:18 +02:00
parent 3e8284bfc0
commit 2fe9656c84
+4 -4
View File
@@ -36,8 +36,8 @@ pub fn load(path: &str) -> Result<Vec<AlphaIdEntry>, AppError> {
/// The primary ICD code a matched entry contributes (falls back to star/addon). /// The primary ICD code a matched entry contributes (falls back to star/addon).
pub fn primary_code(e: &AlphaIdEntry) -> Option<&str> { pub fn primary_code(e: &AlphaIdEntry) -> Option<&str> {
for c in [&e.icd_primary, &e.icd_primary2, &e.icd_star, &e.icd_addon] { [&e.icd_primary, &e.icd_primary2, &e.icd_star, &e.icd_addon]
if !c.is_empty() { return Some(c); } .into_iter()
} .find(|c| !c.is_empty())
None .map(|s| s.as_str())
} }