Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit fa7d436

Browse files
nrcXanewok
andauthored
Apply suggestions from code review
Co-Authored-By: Igor Matuszewski <[email protected]>
1 parent d02f1f8 commit fa7d436

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

rls-span/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl Column<ZeroIndexed> {
8484

8585
impl Step for Column<ZeroIndexed> {
8686
fn steps_between(start: &Self, end: &Self) -> Option<usize> {
87-
Some((end.0 - start.0) as usize)
87+
<u32 as Step>::steps_between(&start.0, &end.0)
8888
}
8989

9090
fn replace_one(&mut self) -> Self {
@@ -106,7 +106,7 @@ impl Step for Column<ZeroIndexed> {
106106
}
107107

108108
fn add_usize(&self, n: usize) -> Option<Self> {
109-
(self.0 as usize).checked_add(n).and_then(|n| u32::try_from(n).ok().map(|n| Self::new(n)))
109+
(self.0 as usize).checked_add(n).and_then(|n| u32::try_from(n).ok()).map(Self::new)
110110
}
111111
}
112112

@@ -134,7 +134,7 @@ impl Step for Column<OneIndexed> {
134134
}
135135

136136
fn add_usize(&self, n: usize) -> Option<Self> {
137-
(self.0 as usize).checked_add(n).and_then(|n| u32::try_from(n).ok().map(|n| Self::new(n)))
137+
(self.0 as usize).checked_add(n).and_then(|n| u32::try_from(n).ok()).map(Self::new)
138138
}
139139
}
140140

@@ -225,7 +225,7 @@ impl Step for Row<ZeroIndexed> {
225225
}
226226

227227
fn add_usize(&self, n: usize) -> Option<Self> {
228-
(self.0 as usize).checked_add(n).and_then(|n| u32::try_from(n).ok().map(|n| Self::new(n)))
228+
(self.0 as usize).checked_add(n).and_then(|n| u32::try_from(n).ok()).map(Self::new)
229229
}
230230
}
231231

@@ -253,7 +253,7 @@ impl Step for Row<OneIndexed> {
253253
}
254254

255255
fn add_usize(&self, n: usize) -> Option<Self> {
256-
(self.0 as usize).checked_add(n).and_then(|n| u32::try_from(n).ok().map(|n| Self::new(n)))
256+
(self.0 as usize).checked_add(n).and_then(|n| u32::try_from(n).ok()).map(Self::new)
257257
}
258258
}
259259

0 commit comments

Comments
 (0)