Skip to content

Commit a314465

Browse files
committed
Fix Clippy: use is_multiple_of() instead of modulo check
1 parent 708a238 commit a314465

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

example-server/src/modules/orders.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ async fn order_processor(store: OrderStore) {
164164
// Simulate state transitions
165165
let new_status = match current_status {
166166
OrderStatus::Pending => {
167-
if processed_count % 10 == 0 {
167+
if processed_count.is_multiple_of(10) {
168168
tracing::warn!(
169169
order_id = %order_id,
170170
current_status = "pending",
@@ -296,7 +296,7 @@ async fn fraud_detection_monitor() {
296296
}
297297

298298
// Simulate occasional false positive review
299-
if scan_count % 23 == 0 {
299+
if scan_count.is_multiple_of(23) {
300300
tracing::info!(
301301
scan_id = %scan_count,
302302
review_type = "manual_review_required",
@@ -450,7 +450,7 @@ async fn create_order(
450450
);
451451

452452
// Simulate occasional payment failure
453-
if order_id.as_u128() % 10 == 0 {
453+
if order_id.as_u128().is_multiple_of(10) {
454454
tracing::error!(
455455
order_id = %order_id_str,
456456
user_id = %req.user_id,

example-server/src/modules/products.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ async fn cache_warmer() {
204204
);
205205

206206
// Occasionally report cache pressure
207-
if warm_count % 7 == 0 {
207+
if warm_count.is_multiple_of(7) {
208208
tracing::debug!(
209209
cache_region = %region,
210210
memory_usage_mb = %(simulated_entries / 10),

example-server/src/modules/users.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ async fn user_activity_simulator(store: UserStore) {
140140
);
141141

142142
// Occasionally log suspicious activity
143-
if event_id % 17 == 0 {
143+
if event_id.is_multiple_of(17) {
144144
tracing::warn!(
145145
user_id = %user.id,
146146
username = %user.username,

0 commit comments

Comments
 (0)