diff --git a/src/admin/room/commands.rs b/src/admin/room/commands.rs index 41cc427f..ae865c27 100644 --- a/src/admin/room/commands.rs +++ b/src/admin/room/commands.rs @@ -180,7 +180,7 @@ pub(super) async fn purge_all_sync_tokens( total_rooms_checked = total_rooms_checked.saturating_add(1); // Log progress periodically - if total_rooms_checked % 100 == 0 || total_rooms_checked == total_rooms { + if total_rooms_checked.is_multiple_of(100) || total_rooms_checked == total_rooms { info!( "Progress: {}/{} rooms checked, {} tokens {}", total_rooms_checked, diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index 93c45af9..6ecd7113 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -2576,7 +2576,7 @@ fn default_roomid_spacehierarchy_cache_capacity() -> u32 { parallelism_scaled_u32(500).clamp(100, 12000) } -fn default_dns_cache_entries() -> u32 { 327680 } +fn default_dns_cache_entries() -> u32 { 327_680 } fn default_dns_min_ttl() -> u64 { 60 * 180 } @@ -2784,17 +2784,23 @@ fn default_admin_log_capture() -> String { fn default_admin_room_tag() -> String { "m.server_notice".to_owned() } +#[must_use] #[allow(clippy::as_conversions, clippy::cast_precision_loss)] pub fn parallelism_scaled_f64(val: f64) -> f64 { val * (sys::available_parallelism() as f64) } +#[must_use] +#[allow(clippy::as_conversions, clippy::cast_possible_truncation)] pub fn parallelism_scaled_u32(val: u32) -> u32 { val.saturating_mul(sys::available_parallelism() as u32) } +#[must_use] +#[allow(clippy::as_conversions, clippy::cast_possible_truncation, clippy::cast_possible_wrap)] pub fn parallelism_scaled_i32(val: i32) -> i32 { val.saturating_mul(sys::available_parallelism() as i32) } +#[must_use] pub fn parallelism_scaled(val: usize) -> usize { val.saturating_mul(sys::available_parallelism()) } diff --git a/src/service/rooms/event_handler/upgrade_outlier_pdu.rs b/src/service/rooms/event_handler/upgrade_outlier_pdu.rs index cd6d1815..8ec990f5 100644 --- a/src/service/rooms/event_handler/upgrade_outlier_pdu.rs +++ b/src/service/rooms/event_handler/upgrade_outlier_pdu.rs @@ -197,13 +197,13 @@ where .await; extremities.push(incoming_pdu.event_id().to_owned()); - if extremities.len() == 0 { + if extremities.is_empty() { info!( "Retained zero extremities when upgrading outlier PDU to timeline PDU with {} \ previous events, event id: {}", incoming_pdu.prev_events.len(), incoming_pdu.event_id - ) + ); } debug!(