Skip to content

Commit f9475b0

Browse files
canyugsclaude
andcommitted
fix: satisfy clippy::manual_is_multiple_of (Rust 1.96 stable)
Stable clippy 1.96 added manual_is_multiple_of; pre-existing modulo checks in openab-core (format.rs, pre_seed.rs) and openab-gateway (wecom.rs) fail `clippy --workspace -D warnings`. Mechanical fix; unblocks CI. Unrelated to the OAuth change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 90cc60e commit f9475b0

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

crates/openab-core/src/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ mod tests {
319319
for (i, chunk) in chunks.iter().enumerate() {
320320
let fence_count = chunk.lines().filter(|l| l.starts_with("```")).count();
321321
assert!(
322-
fence_count % 2 == 0,
322+
fence_count.is_multiple_of(2),
323323
"chunk {i} has unbalanced fences ({fence_count}):\n{chunk}"
324324
);
325325
}

crates/openab-core/src/pre_seed.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ fn extract_zip_budgeted(
222222

223223
for i in 0..file_count {
224224
// Cooperative deadline check per file
225-
if i % 100 == 0 && Instant::now() >= deadline {
225+
if i.is_multiple_of(100) && Instant::now() >= deadline {
226226
anyhow::bail!("hooks.pre_seed: timed out during extraction at entry {i}");
227227
}
228228

@@ -286,7 +286,7 @@ fn extract_tarball_with_limits(data: &[u8], dest: &Path, deadline: Instant) -> a
286286
}
287287

288288
// Cooperative deadline check every 10 files
289-
if file_count % 10 == 0 && Instant::now() >= deadline {
289+
if file_count.is_multiple_of(10) && Instant::now() >= deadline {
290290
anyhow::bail!("hooks.pre_seed: timed out during tarball extraction at entry {file_count}");
291291
}
292292

crates/openab-gateway/src/adapters/wecom.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ fn decrypt_message(
137137
.decode(encrypted)
138138
.map_err(|e| anyhow::anyhow!("base64 decode failed: {e}"))?;
139139

140-
if cipher_bytes.is_empty() || cipher_bytes.len() % 16 != 0 {
140+
if cipher_bytes.is_empty() || !cipher_bytes.len().is_multiple_of(16) {
141141
anyhow::bail!("ciphertext length {} not a multiple of 16", cipher_bytes.len());
142142
}
143143

0 commit comments

Comments
 (0)