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).
|
/// 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())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user