We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a212c30 + dd806bd commit 0f195eaCopy full SHA for 0f195ea
plotters/src/coord/ranged1d/types/numeric.rs
@@ -26,10 +26,9 @@ macro_rules! impl_discrete_trait {
26
}
27
28
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
+ Self::ValueType::try_from(index)
+ .ok()
+ .and_then(|index| self.0.checked_add(index))
33
34
35
};
0 commit comments