refactor: idiomatic find in primary_code (clippy)
This commit is contained in:
+4
-4
@@ -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).
|
||||
pub fn primary_code(e: &AlphaIdEntry) -> Option<&str> {
|
||||
for c in [&e.icd_primary, &e.icd_primary2, &e.icd_star, &e.icd_addon] {
|
||||
if !c.is_empty() { return Some(c); }
|
||||
}
|
||||
None
|
||||
[&e.icd_primary, &e.icd_primary2, &e.icd_star, &e.icd_addon]
|
||||
.into_iter()
|
||||
.find(|c| !c.is_empty())
|
||||
.map(|s| s.as_str())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user