From 0eb14118924aa9561a26c7e6c5bf4fff45fd9c01 Mon Sep 17 00:00:00 2001 From: Max Whitehead Date: Sun, 3 Nov 2024 12:59:09 -0800 Subject: [PATCH] chore(ci): Clippy + doc warnings --- .../bones_framework/src/networking/desync.rs | 11 ++++++----- framework_crates/bones_utils/macros/src/lib.rs | 2 +- framework_crates/bones_utils/tests/tests.rs | 1 + other_crates/bones_matchmaker/src/matchmaking.rs | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/framework_crates/bones_framework/src/networking/desync.rs b/framework_crates/bones_framework/src/networking/desync.rs index 131164eaf6..d760371bc8 100644 --- a/framework_crates/bones_framework/src/networking/desync.rs +++ b/framework_crates/bones_framework/src/networking/desync.rs @@ -1,11 +1,12 @@ -//! +//! Desync detection and history buffer for desync trees. + use std::collections::VecDeque; -use bones_lib::{ecs::World, prelude::default}; +use bones_lib::prelude::*; /// Max frames of data in desync history buffer - this is set to match `ggrs::MAX_CHECKSUM_HISTORY_SIZE`, /// but is private so cannot be used directly. -const MAX_DESYNC_HISTORY_BUFFER: usize = 32; +pub const MAX_DESYNC_HISTORY_BUFFER: usize = 32; /// Settings for desync detection #[derive(Clone)] @@ -18,7 +19,7 @@ pub struct DetectDesyncs { /// By default, [`World`]'s [`DesyncHash`] impl is used. pub world_hash_func: Option u64>, - /// When using feature `desync-debug`, a [`DesyncTree`] will be built. Resources and Components + /// When using feature `desync-debug`, a [`bones_utils::DesyncTree`] will be built. Resources and Components /// that do not support hashing can be optionally included in tree to help highlight candidates /// to be opted into desync-detection. pub include_unhashable_nodes: bool, @@ -33,7 +34,7 @@ impl Default for DetectDesyncs { } } } -/// Store history of desync detection data, such as a [`DesyncTree`]. When ggrs finds a desync in past, +/// Store history of desync detection data, such as a [`bones_utils::DesyncTree`]. When ggrs finds a desync in past, /// we can retrieve this data for debugging. Ggrs has a fixed limit of pending desync frames it tests, /// so we match it by keeping the last [`MAX_DESYNC_HISTORY_BUFFER`] of frame data at the desync detect interval. /// diff --git a/framework_crates/bones_utils/macros/src/lib.rs b/framework_crates/bones_utils/macros/src/lib.rs index f3e8da090c..cbb0ee7001 100644 --- a/framework_crates/bones_utils/macros/src/lib.rs +++ b/framework_crates/bones_utils/macros/src/lib.rs @@ -23,7 +23,7 @@ fn is_simple_named_attr(attr: &venial::Attribute, name: &str) -> bool { /// Attribute adding extra functionality for networking. /// /// For example, provides sugar for `#[derive_type_data(SchemaDesyncHash)]`, which -/// opts in [`SchemaRef`] to support [`DesyncHash`], so it maybe be included in hash for desync detection. +/// opts in `SchemaRef` to support [`DesyncHash`], so it maybe be included in hash for desync detection. #[proc_macro_attribute] pub fn net(_attr: TokenStream, item: TokenStream) -> TokenStream { // Error if #[net] is used with #[schema(no_clone)]. diff --git a/framework_crates/bones_utils/tests/tests.rs b/framework_crates/bones_utils/tests/tests.rs index 9c40e5eeca..e35847516f 100644 --- a/framework_crates/bones_utils/tests/tests.rs +++ b/framework_crates/bones_utils/tests/tests.rs @@ -23,6 +23,7 @@ struct StructB { #[derive(HasSchema, DesyncHash, Debug, Clone, Default)] #[desync_hash_module(crate)] +#[allow(dead_code)] struct StructC { a: f32, #[desync_exclude] diff --git a/other_crates/bones_matchmaker/src/matchmaking.rs b/other_crates/bones_matchmaker/src/matchmaking.rs index 68128f6d6b..07c9a44378 100644 --- a/other_crates/bones_matchmaker/src/matchmaking.rs +++ b/other_crates/bones_matchmaker/src/matchmaking.rs @@ -216,7 +216,7 @@ async fn send_matchmaking_updates( })?; // Send first update and check active connections - for (_index, conn) in connections.into_iter().enumerate() { + for conn in connections.into_iter() { if let Ok(mut send) = conn.open_uni().await { if send.write_all(&first_update_message).await.is_ok() && send.finish().is_ok()