Skip to content

Commit 9d9440a

Browse files
committed
refactor(nodedb-types): use is_multiple_of for even-length check in KV duration parsing
1 parent d4838a1 commit 9d9440a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

nodedb-types/src/kv_parsing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub fn parse_interval_to_ms(s: &str) -> Result<u64, IntervalParseError> {
6666
// Long-form: "15 minutes", "1 hour", "2 days 12 hours", "30 seconds"
6767
// Supports compound: "2 hours 30 minutes" by parsing pairs of (number, unit).
6868
let parts: Vec<&str> = unquoted.split_whitespace().collect();
69-
if parts.len() >= 2 && parts.len() % 2 == 0 {
69+
if parts.len() >= 2 && parts.len().is_multiple_of(2) {
7070
let mut total_ms: u64 = 0;
7171
for chunk in parts.chunks(2) {
7272
let amount: u64 = chunk[0]

0 commit comments

Comments
 (0)