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.
1 parent e4d550d commit 40e1b84Copy full SHA for 40e1b84
src/otp/otp_element.rs
@@ -232,11 +232,7 @@ impl OTPElement {
232
.checked_pow(self.digits as u32)
233
.ok_or(OtpError::InvalidDigits)?;
234
let s = (value as u64 % exponential).to_string();
235
- Ok("0".repeat(
236
- (self.digits as usize)
237
- .checked_sub(s.chars().count())
238
- .unwrap_or(0),
239
- ) + s.as_str())
+ Ok("0".repeat((self.digits as usize).saturating_sub(s.chars().count())) + s.as_str())
240
}
241
242
0 commit comments