Skip to content

Commit 1e8ff30

Browse files
committed
Avoid parsing a const value on versions
1 parent d894e80 commit 1e8ff30

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

shared/src/pdn.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ impl PdnHoster {
146146
.ok_or(HosterError::DepParser)?
147147
.0
148148
.split('.')
149-
.chain(iter::repeat("-1"))
150-
.map(|x| x.parse::<i32>().map_err(|_| HosterError::DepParser));
149+
.map(str::parse::<i32>)
150+
.chain(iter::repeat(Ok(-1)))
151+
.map(|r| r.map_err(|_| HosterError::DepParser));
151152
let version = Version {
152153
major: version_iter.next().ok_or(HosterError::DepParser)??,
153154
minor: version_iter.next().ok_or(HosterError::DepParser)??,

0 commit comments

Comments
 (0)