Skip to content

Commit 0f195ea

Browse files
authored
Merge pull request #667 from 10ne1/dev/aratiu/fix-irrefutable-let-warn
coord: ranged1d: fix irrefutable if let warning
2 parents a212c30 + dd806bd commit 0f195ea

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

plotters/src/coord/ranged1d/types/numeric.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ macro_rules! impl_discrete_trait {
2626
}
2727

2828
fn from_index(&self, index: usize) -> Option<Self::ValueType> {
29-
if let Ok(index) = Self::ValueType::try_from(index) {
30-
return Some(self.0 + index);
31-
}
32-
None
29+
Self::ValueType::try_from(index)
30+
.ok()
31+
.and_then(|index| self.0.checked_add(index))
3332
}
3433
}
3534
};

0 commit comments

Comments
 (0)