diff --git a/Cargo.toml b/Cargo.toml index c95bc3998..2ace1b97e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,9 @@ keywords = ["minecraft", "gamedev", "server", "ecs"] categories = ["game-engines"] include = ["/src", "/benches", "/examples", "/README.md", "/LICENSE.txt"] +[lints] +workspace = true + [features] default = [ "advancement", @@ -207,3 +210,111 @@ valence_text = { path = "crates/valence_text", version = "0.2.0-alpha.1" } valence_weather = { path = "crates/valence_weather", version = "0.2.0-alpha.1" } valence_world_border = { path = "crates/valence_world_border", version = "0.2.0-alpha.1" } zip = "0.6.3" + +[workspace.lints.rust] +# missing_debug_implementations = "warn" # TODO: enable me. +# missing_docs = "warn" +nonstandard_style = "warn" +rust_2018_idioms = "warn" +elided_lifetimes_in_paths = "allow" # TODO: Remove me? +trivial_numeric_casts = "warn" +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(unstable_doc)'] } +unreachable_pub = "warn" +unused_import_braces = "warn" +unused_lifetimes = "warn" + +[workspace.lints.clippy] +alloc_instead_of_core = "warn" +as_ptr_cast_mut = "warn" +as_underscore = "warn" +bool_to_int_with_if = "warn" +case_sensitive_file_extension_comparisons = "warn" +cast_lossless = "warn" +checked_conversions = "warn" +cloned_instead_of_copied = "warn" +copy_iterator = "warn" +dbg_macro = "warn" +doc_link_with_quotes = "warn" +doc_markdown = "warn" +empty_enum_variants_with_brackets = "warn" +empty_structs_with_brackets = "warn" +explicit_deref_methods = "warn" +explicit_into_iter_loop = "warn" +explicit_iter_loop = "warn" +filter_map_next = "warn" +flat_map_option = "warn" +format_push_string = "warn" +from_iter_instead_of_collect = "warn" +get_unwrap = "warn" +if_then_some_else_none = "warn" +ignored_unit_patterns = "warn" +impl_trait_in_params = "warn" +implicit_clone = "warn" +inconsistent_struct_constructor = "warn" +inefficient_to_string = "warn" +infinite_loop = "warn" +into_iter_without_iter = "warn" +invalid_upcast_comparisons = "warn" +iter_filter_is_ok = "warn" +iter_filter_is_some = "warn" +iter_not_returning_iterator = "warn" +iter_over_hash_type = "warn" +iter_without_into_iter = "warn" +large_stack_arrays = "warn" +large_types_passed_by_value = "warn" +macro_use_imports = "warn" +manual_assert = "warn" +manual_instant_elapsed = "warn" +manual_is_variant_and = "warn" +manual_let_else = "warn" +manual_ok_or = "warn" +manual_string_new = "warn" +map_unwrap_or = "warn" +match_bool = "warn" +match_wildcard_for_single_variants = "warn" +mismatching_type_param_order = "warn" +missing_fields_in_debug = "warn" +mixed_read_write_in_expression = "warn" +mod_module_files = "warn" +multiple_inherent_impl = "warn" +mut_mut = "warn" +mutex_atomic = "warn" +needless_bitwise_bool = "warn" +needless_continue = "warn" +needless_for_each = "warn" +needless_raw_string_hashes = "warn" +needless_raw_strings = "warn" +negative_feature_names = "warn" +no_mangle_with_rust_abi = "warn" +option_as_ref_cloned = "warn" +pub_underscore_fields = "warn" +rc_buffer = "warn" +rc_mutex = "warn" +redundant_else = "warn" +redundant_feature_names = "warn" +ref_patterns = "warn" +rest_pat_in_fully_bound_structs = "warn" +semicolon_outside_block = "warn" +str_to_string = "warn" +string_lit_chars_any = "warn" +string_to_string = "warn" +struct_field_names = "warn" +tests_outside_test_module = "warn" +todo = "warn" +trivially_copy_pass_by_ref = "warn" +try_err = "warn" +# undocumented_unsafe_blocks = "warn" +uninlined_format_args = "warn" +unnecessary_join = "warn" +# unnecessary_safety_doc = "warn" +unnecessary_self_imports = "warn" +unneeded_field_pattern = "warn" +unnested_or_patterns = "warn" +unseparated_literal_suffix = "warn" +unused_self = "warn" +used_underscore_binding = "warn" +wildcard_dependencies = "warn" +zero_sized_map_values = "warn" + +[workspace.lints.rustdoc] +unescaped_backticks = "warn" diff --git a/crates/java_string/Cargo.toml b/crates/java_string/Cargo.toml index 0465f63c2..f7300de90 100644 --- a/crates/java_string/Cargo.toml +++ b/crates/java_string/Cargo.toml @@ -9,6 +9,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [features] serde = ["dep:serde"] diff --git a/crates/valence_advancement/Cargo.toml b/crates/valence_advancement/Cargo.toml index a74d009b5..af078222b 100644 --- a/crates/valence_advancement/Cargo.toml +++ b/crates/valence_advancement/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] valence_server.workspace = true bevy_app.workspace = true diff --git a/crates/valence_advancement/src/lib.rs b/crates/valence_advancement/src/lib.rs index a5229f025..10547679e 100644 --- a/crates/valence_advancement/src/lib.rs +++ b/crates/valence_advancement/src/lib.rs @@ -1,5 +1,4 @@ #![doc = include_str!("../README.md")] -#![allow(clippy::type_complexity)] pub mod event; diff --git a/crates/valence_anvil/Cargo.toml b/crates/valence_anvil/Cargo.toml index 7a4c13b15..c9bb7844d 100644 --- a/crates/valence_anvil/Cargo.toml +++ b/crates/valence_anvil/Cargo.toml @@ -9,6 +9,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [features] bevy_plugin = ["dep:bevy_app", "dep:bevy_ecs", "dep:flume", "parsing"] parsing = ["dep:valence_server"] diff --git a/crates/valence_anvil/src/lib.rs b/crates/valence_anvil/src/lib.rs index b50507c4b..ee3081808 100644 --- a/crates/valence_anvil/src/lib.rs +++ b/crates/valence_anvil/src/lib.rs @@ -1,21 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] use std::fs::{DirEntry, File}; use std::hash::Hash; diff --git a/crates/valence_boss_bar/Cargo.toml b/crates/valence_boss_bar/Cargo.toml index 7960ffe86..5962f5c41 100644 --- a/crates/valence_boss_bar/Cargo.toml +++ b/crates/valence_boss_bar/Cargo.toml @@ -9,6 +9,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] valence_entity.workspace = true valence_server.workspace = true diff --git a/crates/valence_boss_bar/src/lib.rs b/crates/valence_boss_bar/src/lib.rs index ea4b9ec29..b1bfed041 100644 --- a/crates/valence_boss_bar/src/lib.rs +++ b/crates/valence_boss_bar/src/lib.rs @@ -1,22 +1,4 @@ #![doc = include_str!("../README.md")] -#![allow(clippy::type_complexity)] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] use std::borrow::Cow; diff --git a/crates/valence_build_utils/Cargo.toml b/crates/valence_build_utils/Cargo.toml index 7a928faaf..af5222dec 100644 --- a/crates/valence_build_utils/Cargo.toml +++ b/crates/valence_build_utils/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] anyhow.workspace = true syn.workspace = true diff --git a/crates/valence_build_utils/src/lib.rs b/crates/valence_build_utils/src/lib.rs index 775f82a75..4a1ed0c57 100644 --- a/crates/valence_build_utils/src/lib.rs +++ b/crates/valence_build_utils/src/lib.rs @@ -1,21 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] use std::path::Path; use std::process::Command; diff --git a/crates/valence_command/Cargo.toml b/crates/valence_command/Cargo.toml index 125f68e92..1e8b02ecc 100644 --- a/crates/valence_command/Cargo.toml +++ b/crates/valence_command/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] anyhow.workspace = true bevy_app.workspace = true diff --git a/crates/valence_command/src/handler.rs b/crates/valence_command/src/handler.rs index 59bfda3ed..32efa0fad 100644 --- a/crates/valence_command/src/handler.rs +++ b/crates/valence_command/src/handler.rs @@ -61,7 +61,7 @@ struct CommandResource { } impl CommandResource { - pub fn new() -> Self { + fn new() -> Self { CommandResource { command: PhantomData, executables: HashMap::new(), diff --git a/crates/valence_command_macros/Cargo.toml b/crates/valence_command_macros/Cargo.toml index 60657a4f5..f639f275f 100644 --- a/crates/valence_command_macros/Cargo.toml +++ b/crates/valence_command_macros/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [lib] proc-macro = true diff --git a/crates/valence_entity/Cargo.toml b/crates/valence_entity/Cargo.toml index 7e01c41dd..77b5d9feb 100644 --- a/crates/valence_entity/Cargo.toml +++ b/crates/valence_entity/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] anyhow.workspace = true bevy_app.workspace = true diff --git a/crates/valence_entity/build.rs b/crates/valence_entity/build.rs index 46c70ccb3..030b14f43 100644 --- a/crates/valence_entity/build.rs +++ b/crates/valence_entity/build.rs @@ -96,7 +96,7 @@ struct BlockPos { } impl Value { - pub fn type_id(&self) -> u8 { + fn type_id(&self) -> u8 { match self { Value::Byte(_) => 0, Value::Integer(_) => 1, @@ -129,7 +129,7 @@ impl Value { } } - pub fn field_type(&self) -> TokenStream { + fn field_type(&self) -> TokenStream { match self { Value::Byte(_) => quote!(i8), Value::Integer(_) => quote!(i32), @@ -162,7 +162,7 @@ impl Value { } } - pub fn default_expr(&self) -> TokenStream { + fn default_expr(&self) -> TokenStream { match self { Value::Byte(b) => quote!(#b), Value::Integer(i) => quote!(#i), @@ -266,7 +266,7 @@ impl Value { } } - pub fn encodable_expr(&self, self_lvalue: TokenStream) -> TokenStream { + fn encodable_expr(&self, self_lvalue: TokenStream) -> TokenStream { match self { Value::Integer(_) => quote!(VarInt(#self_lvalue)), Value::OptionalInt(_) => quote!(OptionalInt(#self_lvalue)), diff --git a/crates/valence_entity/src/lib.rs b/crates/valence_entity/src/lib.rs index da32fc9e5..f5be5fff3 100644 --- a/crates/valence_entity/src/lib.rs +++ b/crates/valence_entity/src/lib.rs @@ -1,22 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] -#![allow(clippy::type_complexity)] pub mod active_status_effects; pub mod attributes; diff --git a/crates/valence_generated/Cargo.toml b/crates/valence_generated/Cargo.toml index 86fb64933..3cc9f4a4e 100644 --- a/crates/valence_generated/Cargo.toml +++ b/crates/valence_generated/Cargo.toml @@ -9,6 +9,9 @@ documentation.workspace = true license.workspace = true build = "build/main.rs" +[lints] +workspace = true + [dependencies] valence_math.workspace = true valence_ident.workspace = true diff --git a/crates/valence_generated/build/attributes.rs b/crates/valence_generated/build/attributes.rs index 4879d1950..b939edc95 100644 --- a/crates/valence_generated/build/attributes.rs +++ b/crates/valence_generated/build/attributes.rs @@ -16,7 +16,7 @@ struct EntityAttribute { max_value: f64, } -pub fn build() -> anyhow::Result { +pub(crate) fn build() -> anyhow::Result { rerun_if_changed(["extracted/attributes.json"]); let entity_attributes: BTreeMap = diff --git a/crates/valence_generated/build/block.rs b/crates/valence_generated/build/block.rs index 78e743fe9..10ced4ba8 100644 --- a/crates/valence_generated/build/block.rs +++ b/crates/valence_generated/build/block.rs @@ -26,11 +26,11 @@ struct Block { } impl Block { - pub fn min_state_id(&self) -> u16 { + pub(crate) fn min_state_id(&self) -> u16 { self.states.iter().map(|s| s.id).min().unwrap() } - pub fn max_state_id(&self) -> u16 { + pub(crate) fn max_state_id(&self) -> u16 { self.states.iter().map(|s| s.id).max().unwrap() } } @@ -69,7 +69,7 @@ struct Shape { max_z: f64, } -pub fn build() -> anyhow::Result { +pub(crate) fn build() -> anyhow::Result { rerun_if_changed(["extracted/blocks.json"]); let TopLevel { diff --git a/crates/valence_generated/build/chunk_view.rs b/crates/valence_generated/build/chunk_view.rs index ebf80d8cf..f5391d252 100644 --- a/crates/valence_generated/build/chunk_view.rs +++ b/crates/valence_generated/build/chunk_view.rs @@ -4,7 +4,7 @@ use quote::quote; const MAX_VIEW_DIST: u8 = 32; const EXTRA_VIEW_RADIUS: i32 = 2; -pub fn build() -> TokenStream { +pub(crate) fn build() -> TokenStream { let entries = (0..=MAX_VIEW_DIST).map(|dist| { let dist = dist as i32 + EXTRA_VIEW_RADIUS; diff --git a/crates/valence_generated/build/item.rs b/crates/valence_generated/build/item.rs index 868f70524..248212982 100644 --- a/crates/valence_generated/build/item.rs +++ b/crates/valence_generated/build/item.rs @@ -27,7 +27,7 @@ struct FoodComponent { // TODO: effects } -pub fn build() -> anyhow::Result { +pub(crate) fn build() -> anyhow::Result { rerun_if_changed(["extracted/items.json"]); let items = serde_json::from_str::>(include_str!("../extracted/items.json"))?; diff --git a/crates/valence_generated/build/packet_id.rs b/crates/valence_generated/build/packet_id.rs index 90b256174..740fdd20f 100644 --- a/crates/valence_generated/build/packet_id.rs +++ b/crates/valence_generated/build/packet_id.rs @@ -12,7 +12,7 @@ struct Packet { id: i32, } -pub fn build() -> anyhow::Result { +pub(crate) fn build() -> anyhow::Result { rerun_if_changed(["extracted/packets.json"]); let packets: Vec = serde_json::from_str(include_str!("../extracted/packets.json"))?; diff --git a/crates/valence_generated/build/sound.rs b/crates/valence_generated/build/sound.rs index ea48630ce..6abd4f6ca 100644 --- a/crates/valence_generated/build/sound.rs +++ b/crates/valence_generated/build/sound.rs @@ -5,12 +5,12 @@ use serde::Deserialize; use valence_build_utils::{ident, rerun_if_changed}; #[derive(Deserialize, Debug)] -pub struct Sound { +struct Sound { id: u16, name: String, } -pub fn build() -> anyhow::Result { +pub(crate) fn build() -> anyhow::Result { rerun_if_changed(["extracted/sounds.json"]); let sounds = serde_json::from_str::>(include_str!("../extracted/sounds.json"))?; diff --git a/crates/valence_generated/build/status_effects.rs b/crates/valence_generated/build/status_effects.rs index eb9ce4726..e53e7ef2a 100644 --- a/crates/valence_generated/build/status_effects.rs +++ b/crates/valence_generated/build/status_effects.rs @@ -5,14 +5,14 @@ use serde::Deserialize; use valence_build_utils::{ident, rerun_if_changed}; #[derive(Deserialize, Debug)] -pub enum StatusEffectCategory { +pub(crate) enum StatusEffectCategory { Beneficial, Harmful, Neutral, } #[derive(Deserialize, Debug)] -pub struct AttributeModifiers { +pub(crate) struct AttributeModifiers { attribute: u8, operation: u8, value: f64, @@ -20,7 +20,7 @@ pub struct AttributeModifiers { } #[derive(Deserialize, Debug)] -pub struct StatusEffect { +pub(crate) struct StatusEffect { id: u16, name: String, translation_key: String, @@ -30,7 +30,7 @@ pub struct StatusEffect { attribute_modifiers: Option>, } -pub fn build() -> anyhow::Result { +pub(crate) fn build() -> anyhow::Result { rerun_if_changed(["extracted/effects.json"]); let effects = diff --git a/crates/valence_ident/Cargo.toml b/crates/valence_ident/Cargo.toml index 09b5220ab..c971cde26 100644 --- a/crates/valence_ident/Cargo.toml +++ b/crates/valence_ident/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] thiserror.workspace = true serde.workspace = true diff --git a/crates/valence_ident_macros/Cargo.toml b/crates/valence_ident_macros/Cargo.toml index f83651c8c..3443b7bcd 100644 --- a/crates/valence_ident_macros/Cargo.toml +++ b/crates/valence_ident_macros/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [lib] proc-macro = true diff --git a/crates/valence_inventory/Cargo.toml b/crates/valence_inventory/Cargo.toml index f38aa99a0..b2c8a397f 100644 --- a/crates/valence_inventory/Cargo.toml +++ b/crates/valence_inventory/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] bevy_app.workspace = true bevy_ecs.workspace = true diff --git a/crates/valence_inventory/src/lib.rs b/crates/valence_inventory/src/lib.rs index 6e450eac6..1fea76a88 100644 --- a/crates/valence_inventory/src/lib.rs +++ b/crates/valence_inventory/src/lib.rs @@ -1,22 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] -#![allow(clippy::type_complexity)] use std::borrow::Cow; use std::iter::FusedIterator; diff --git a/crates/valence_lang/Cargo.toml b/crates/valence_lang/Cargo.toml index e36fc9493..da0cf33de 100644 --- a/crates/valence_lang/Cargo.toml +++ b/crates/valence_lang/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [build-dependencies] anyhow.workspace = true heck.workspace = true diff --git a/crates/valence_math/Cargo.toml b/crates/valence_math/Cargo.toml index 08badf18c..6c1dc7f6c 100644 --- a/crates/valence_math/Cargo.toml +++ b/crates/valence_math/Cargo.toml @@ -8,5 +8,8 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] glam.workspace = true diff --git a/crates/valence_nbt/Cargo.toml b/crates/valence_nbt/Cargo.toml index 3c60fd038..5252323fa 100644 --- a/crates/valence_nbt/Cargo.toml +++ b/crates/valence_nbt/Cargo.toml @@ -9,6 +9,9 @@ version = "0.8.0" edition.workspace = true repository.workspace = true +[lints] +workspace = true + [features] binary = ["dep:byteorder", "dep:cesu8"] java_string = ["dep:java_string"] diff --git a/crates/valence_nbt/src/lib.rs b/crates/valence_nbt/src/lib.rs index f422dc9dd..683cd0ed9 100644 --- a/crates/valence_nbt/src/lib.rs +++ b/crates/valence_nbt/src/lib.rs @@ -1,21 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] #[cfg(feature = "binary")] pub use binary::{from_binary, to_binary}; diff --git a/crates/valence_network/Cargo.toml b/crates/valence_network/Cargo.toml index 2e26dec81..c05d1d0fb 100644 --- a/crates/valence_network/Cargo.toml +++ b/crates/valence_network/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + # TODO: make encryption and compression optional features. [dependencies] diff --git a/crates/valence_network/src/lib.rs b/crates/valence_network/src/lib.rs index 916fea25b..e9f723260 100644 --- a/crates/valence_network/src/lib.rs +++ b/crates/valence_network/src/lib.rs @@ -1,21 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] mod byte_channel; mod connect; diff --git a/crates/valence_player_list/Cargo.toml b/crates/valence_player_list/Cargo.toml index 176c94389..6140afc19 100644 --- a/crates/valence_player_list/Cargo.toml +++ b/crates/valence_player_list/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] bevy_app.workspace = true bevy_ecs.workspace = true diff --git a/crates/valence_player_list/src/lib.rs b/crates/valence_player_list/src/lib.rs index 27fbab7d0..0d1f37569 100644 --- a/crates/valence_player_list/src/lib.rs +++ b/crates/valence_player_list/src/lib.rs @@ -1,22 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] -#![allow(clippy::type_complexity)] use std::borrow::Cow; diff --git a/crates/valence_protocol/Cargo.toml b/crates/valence_protocol/Cargo.toml index bee995eca..41bc99d4a 100644 --- a/crates/valence_protocol/Cargo.toml +++ b/crates/valence_protocol/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [features] encryption = ["dep:aes", "dep:cfb8"] compression = ["dep:flate2"] diff --git a/crates/valence_protocol/src/lib.rs b/crates/valence_protocol/src/lib.rs index e200795d8..6b3842ea1 100644 --- a/crates/valence_protocol/src/lib.rs +++ b/crates/valence_protocol/src/lib.rs @@ -1,21 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] /// Used only by macros. Not public API. #[doc(hidden)] diff --git a/crates/valence_protocol_macros/Cargo.toml b/crates/valence_protocol_macros/Cargo.toml index 5f9bf9354..8a4892735 100644 --- a/crates/valence_protocol_macros/Cargo.toml +++ b/crates/valence_protocol_macros/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [lib] proc-macro = true diff --git a/crates/valence_protocol_macros/src/lib.rs b/crates/valence_protocol_macros/src/lib.rs index 46c552024..15ed27376 100644 --- a/crates/valence_protocol_macros/src/lib.rs +++ b/crates/valence_protocol_macros/src/lib.rs @@ -1,21 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] use proc_macro::TokenStream as StdTokenStream; use proc_macro2::TokenStream; diff --git a/crates/valence_registry/Cargo.toml b/crates/valence_registry/Cargo.toml index 8d75d1d25..ab25597c8 100644 --- a/crates/valence_registry/Cargo.toml +++ b/crates/valence_registry/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] bevy_app.workspace = true bevy_ecs.workspace = true diff --git a/crates/valence_registry/src/lib.rs b/crates/valence_registry/src/lib.rs index e059f7cf8..6a62faf16 100644 --- a/crates/valence_registry/src/lib.rs +++ b/crates/valence_registry/src/lib.rs @@ -1,21 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] pub mod biome; pub mod codec; diff --git a/crates/valence_scoreboard/Cargo.toml b/crates/valence_scoreboard/Cargo.toml index 93c25fb21..59825b4e2 100644 --- a/crates/valence_scoreboard/Cargo.toml +++ b/crates/valence_scoreboard/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] bevy_app.workspace = true bevy_ecs.workspace = true diff --git a/crates/valence_scoreboard/src/lib.rs b/crates/valence_scoreboard/src/lib.rs index 6dee4416a..e3195d9b7 100644 --- a/crates/valence_scoreboard/src/lib.rs +++ b/crates/valence_scoreboard/src/lib.rs @@ -1,22 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] -#![allow(clippy::type_complexity)] mod components; use std::collections::BTreeSet; diff --git a/crates/valence_server/Cargo.toml b/crates/valence_server/Cargo.toml index f4cb5be08..c9d69eb82 100644 --- a/crates/valence_server/Cargo.toml +++ b/crates/valence_server/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] anyhow.workspace = true bevy_app.workspace = true diff --git a/crates/valence_server/src/lib.rs b/crates/valence_server/src/lib.rs index 68291b8bc..098b45de3 100644 --- a/crates/valence_server/src/lib.rs +++ b/crates/valence_server/src/lib.rs @@ -1,22 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] -#![allow(clippy::type_complexity)] pub mod abilities; pub mod action; diff --git a/crates/valence_server_common/Cargo.toml b/crates/valence_server_common/Cargo.toml index 12d62c515..8784eced3 100644 --- a/crates/valence_server_common/Cargo.toml +++ b/crates/valence_server_common/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] bevy_ecs.workspace = true bevy_app.workspace = true diff --git a/crates/valence_server_common/src/lib.rs b/crates/valence_server_common/src/lib.rs index 3ca47da97..88ac7c9c2 100644 --- a/crates/valence_server_common/src/lib.rs +++ b/crates/valence_server_common/src/lib.rs @@ -1,22 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] -#![allow(clippy::unusual_byte_groupings)] mod despawn; mod uuid; diff --git a/crates/valence_spatial/Cargo.toml b/crates/valence_spatial/Cargo.toml index 1505d432a..55e198927 100644 --- a/crates/valence_spatial/Cargo.toml +++ b/crates/valence_spatial/Cargo.toml @@ -7,6 +7,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] approx.workspace = true rayon.workspace = true diff --git a/crates/valence_spatial/src/lib.rs b/crates/valence_spatial/src/lib.rs index df9d7a55f..7e7e845e3 100644 --- a/crates/valence_spatial/src/lib.rs +++ b/crates/valence_spatial/src/lib.rs @@ -1,21 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] use vek::{Aabb, Vec3}; diff --git a/crates/valence_text/Cargo.toml b/crates/valence_text/Cargo.toml index e1092f2ab..405ed85ef 100644 --- a/crates/valence_text/Cargo.toml +++ b/crates/valence_text/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] serde = { workspace = true, features = ["derive"] } serde_json.workspace = true diff --git a/crates/valence_weather/Cargo.toml b/crates/valence_weather/Cargo.toml index 18fc33aec..65b429fd6 100644 --- a/crates/valence_weather/Cargo.toml +++ b/crates/valence_weather/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] valence_server.workspace = true bevy_ecs.workspace = true diff --git a/crates/valence_weather/src/lib.rs b/crates/valence_weather/src/lib.rs index 49fbe6b45..ea21e17b7 100644 --- a/crates/valence_weather/src/lib.rs +++ b/crates/valence_weather/src/lib.rs @@ -1,22 +1,4 @@ #![doc = include_str!("../README.md")] -#![allow(clippy::type_complexity)] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] use bevy_app::prelude::*; use bevy_ecs::prelude::*; diff --git a/crates/valence_world_border/Cargo.toml b/crates/valence_world_border/Cargo.toml index d1dc00aa4..1e9292a7e 100644 --- a/crates/valence_world_border/Cargo.toml +++ b/crates/valence_world_border/Cargo.toml @@ -8,6 +8,9 @@ repository.workspace = true documentation.workspace = true license.workspace = true +[lints] +workspace = true + [dependencies] bevy_app.workspace = true bevy_ecs.workspace = true diff --git a/crates/valence_world_border/src/lib.rs b/crates/valence_world_border/src/lib.rs index 16ffae517..17e7102b5 100644 --- a/crates/valence_world_border/src/lib.rs +++ b/crates/valence_world_border/src/lib.rs @@ -1,22 +1,4 @@ #![doc = include_str!("../README.md")] -#![allow(clippy::type_complexity)] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - unreachable_pub, - clippy::dbg_macro -)] use bevy_app::prelude::*; use bevy_ecs::prelude::*; diff --git a/tools/dump_schedule/Cargo.toml b/tools/dump_schedule/Cargo.toml index dc729ebca..a3aab2169 100644 --- a/tools/dump_schedule/Cargo.toml +++ b/tools/dump_schedule/Cargo.toml @@ -7,6 +7,9 @@ documentation.workspace = true license.workspace = true publish = false +[lints] +workspace = true + [dependencies] bevy_mod_debugdump.workspace = true clap.workspace = true diff --git a/tools/dump_schedule/src/main.rs b/tools/dump_schedule/src/main.rs index 85420a8f4..25e0a9ef0 100644 --- a/tools/dump_schedule/src/main.rs +++ b/tools/dump_schedule/src/main.rs @@ -1,20 +1,4 @@ #![doc = include_str!("../README.md")] -#![deny( - rustdoc::broken_intra_doc_links, - rustdoc::private_intra_doc_links, - rustdoc::missing_crate_level_docs, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_rust_codeblocks, - rustdoc::bare_urls, - rustdoc::invalid_html_tags -)] -#![warn( - trivial_casts, - trivial_numeric_casts, - unused_lifetimes, - unused_import_braces, - clippy::dbg_macro -)] use std::io; use std::io::Write; diff --git a/tools/packet_inspector/Cargo.toml b/tools/packet_inspector/Cargo.toml index d2bf7b1b9..aa25f58d3 100644 --- a/tools/packet_inspector/Cargo.toml +++ b/tools/packet_inspector/Cargo.toml @@ -8,6 +8,9 @@ documentation.workspace = true license.workspace = true publish = false +[lints] +workspace = true + [dependencies] valence_protocol = { workspace = true, features = ["compression"] } anyhow.workspace = true diff --git a/tools/packet_inspector/src/app.rs b/tools/packet_inspector/src/app.rs index 0dbe8c837..5792645ff 100644 --- a/tools/packet_inspector/src/app.rs +++ b/tools/packet_inspector/src/app.rs @@ -13,12 +13,12 @@ mod hex_viewer; mod packet_list; mod text_viewer; -pub trait View { +pub(crate) trait View { fn ui(&mut self, ui: &mut egui::Ui, shared_state: &mut SharedState); } /// Something to view -pub trait Tab: View { +pub(crate) trait Tab: View { fn new() -> Self where Self: Sized; @@ -47,14 +47,14 @@ impl egui_dock::TabViewer for TabViewer { } } -pub struct GuiApp { +pub(crate) struct GuiApp { tree: Tree>, shared_state: Arc>, tab_viewer: TabViewer, } impl GuiApp { - pub fn new(cc: &eframe::CreationContext<'_>) -> Self { + pub(crate) fn new(cc: &eframe::CreationContext<'_>) -> Self { let ctx = cc.egui_ctx.clone(); // Default Application Layout diff --git a/tools/packet_inspector/src/app/connection.rs b/tools/packet_inspector/src/app/connection.rs index 90db34108..e665f1b94 100644 --- a/tools/packet_inspector/src/app/connection.rs +++ b/tools/packet_inspector/src/app/connection.rs @@ -1,7 +1,7 @@ use super::{SharedState, Tab, View}; use crate::shared_state::Event; -pub struct Connection {} +pub(crate) struct Connection {} impl Tab for Connection { fn new() -> Self { diff --git a/tools/packet_inspector/src/app/filter.rs b/tools/packet_inspector/src/app/filter.rs index e12e46718..e6af0cb95 100644 --- a/tools/packet_inspector/src/app/filter.rs +++ b/tools/packet_inspector/src/app/filter.rs @@ -5,7 +5,7 @@ use valence_protocol::PacketState; use super::{SharedState, Tab, View}; use crate::tri_checkbox::{TriCheckbox, TriCheckboxState}; -pub struct Filter {} +pub(crate) struct Filter; impl Tab for Filter { fn new() -> Self { diff --git a/tools/packet_inspector/src/app/hex_viewer.rs b/tools/packet_inspector/src/app/hex_viewer.rs index 2c76db9b9..d14894cde 100644 --- a/tools/packet_inspector/src/app/hex_viewer.rs +++ b/tools/packet_inspector/src/app/hex_viewer.rs @@ -2,7 +2,7 @@ use std::io::Read; use super::{SharedState, Tab, View}; -pub struct HexView {} +pub(crate) struct HexView; impl Tab for HexView { fn new() -> Self { diff --git a/tools/packet_inspector/src/app/packet_list.rs b/tools/packet_inspector/src/app/packet_list.rs index 21c1c8272..602d154fd 100644 --- a/tools/packet_inspector/src/app/packet_list.rs +++ b/tools/packet_inspector/src/app/packet_list.rs @@ -8,7 +8,7 @@ use valence_protocol::PacketSide; use super::{SharedState, Tab, View}; -pub struct PacketList {} +pub(crate) struct PacketList; impl Tab for PacketList { fn new() -> Self { @@ -260,7 +260,7 @@ fn get_triangle(direction: PacketSide, outer_rect: &Rect) -> PathShape { shape } -pub fn systemtime_strftime(odt: time::OffsetDateTime) -> String { +pub(crate) fn systemtime_strftime(odt: time::OffsetDateTime) -> String { let hour = odt.hour(); let minute = odt.minute(); let second = odt.second(); diff --git a/tools/packet_inspector/src/app/text_viewer.rs b/tools/packet_inspector/src/app/text_viewer.rs index 739bc3b75..006163a2a 100644 --- a/tools/packet_inspector/src/app/text_viewer.rs +++ b/tools/packet_inspector/src/app/text_viewer.rs @@ -11,7 +11,7 @@ mod utils { include!(concat!(env!("OUT_DIR"), "/packet_to_string.rs")); } -pub struct TextView { +pub(crate) struct TextView { last_packet_id: Option, packet_str: String, } @@ -56,7 +56,7 @@ impl View for TextView { use egui::text::LayoutJob; /// View some code with syntax highlighting and selection. -pub fn code_view_ui(ui: &mut egui::Ui, mut code: &str) { +pub(crate) fn code_view_ui(ui: &mut egui::Ui, mut code: &str) { let language = "rs"; let theme = CodeTheme::from_memory(ui.ctx()); @@ -78,12 +78,8 @@ pub fn code_view_ui(ui: &mut egui::Ui, mut code: &str) { } /// Memoized Code highlighting -pub fn highlight(ctx: &egui::Context, theme: &CodeTheme, code: &str, language: &str) -> LayoutJob { - impl egui::util::cache::ComputerMut<(&CodeTheme, &str, &str), LayoutJob> for Highlighter { - fn compute(&mut self, (theme, code, lang): (&CodeTheme, &str, &str)) -> LayoutJob { - self.highlight(theme, code, lang) - } - } +pub(crate) fn highlight(ctx: &egui::Context, theme: &CodeTheme, code: &str, language: &str) -> LayoutJob { + type HighlightCache = egui::util::cache::FrameCache; @@ -148,7 +144,7 @@ impl SyntectTheme { } } - pub fn is_dark(&self) -> bool { + pub(crate) fn is_dark(&self) -> bool { match self { Self::Base16EightiesDark | Self::Base16MochaDark @@ -162,7 +158,7 @@ impl SyntectTheme { #[derive(Clone, Hash, PartialEq, serde::Deserialize, serde::Serialize)] #[serde(default)] -pub struct CodeTheme { +pub(crate) struct CodeTheme { dark_mode: bool, syntect_theme: SyntectTheme, @@ -176,7 +172,7 @@ impl Default for CodeTheme { #[allow(unused)] impl CodeTheme { - pub fn from_style(style: &egui::Style) -> Self { + pub(crate) fn from_style(style: &egui::Style) -> Self { if style.visuals.dark_mode { Self::dark() } else { @@ -184,7 +180,7 @@ impl CodeTheme { } } - pub fn from_memory(ctx: &egui::Context) -> Self { + pub(crate) fn from_memory(ctx: &egui::Context) -> Self { if ctx.style().visuals.dark_mode { ctx.data_mut(|d| { d.get_persisted(egui::Id::new("dark")) @@ -198,7 +194,7 @@ impl CodeTheme { } } - pub fn store_in_memory(self, ctx: &egui::Context) { + pub(crate) fn store_in_memory(self, ctx: &egui::Context) { if self.dark_mode { ctx.data_mut(|d| d.insert_persisted(egui::Id::new("dark"), self)); } else { @@ -209,21 +205,21 @@ impl CodeTheme { #[allow(unused)] impl CodeTheme { - pub fn dark() -> Self { + pub(crate) fn dark() -> Self { Self { dark_mode: true, syntect_theme: SyntectTheme::SolarizedDark, } } - pub fn light() -> Self { + pub(crate) fn light() -> Self { Self { dark_mode: false, syntect_theme: SyntectTheme::SolarizedLight, } } - pub fn ui(&mut self, ui: &mut egui::Ui) { + pub(crate) fn ui(&mut self, ui: &mut egui::Ui) { egui::widgets::global_dark_light_mode_buttons(ui); for theme in SyntectTheme::all() { @@ -250,6 +246,12 @@ impl Default for Highlighter { } } +impl egui::util::cache::ComputerMut<(&CodeTheme, &str, &str), LayoutJob> for Highlighter { + fn compute(&mut self, (theme, code, lang): (&CodeTheme, &str, &str)) -> LayoutJob { + self.highlight(theme, code, lang) + } +} + impl Highlighter { #[allow(clippy::unused_self, clippy::unnecessary_wraps)] fn highlight(&self, theme: &CodeTheme, code: &str, lang: &str) -> LayoutJob { diff --git a/tools/packet_inspector/src/packet_io.rs b/tools/packet_inspector/src/packet_io.rs index d073db9fb..0ae27a04d 100644 --- a/tools/packet_inspector/src/packet_io.rs +++ b/tools/packet_inspector/src/packet_io.rs @@ -141,7 +141,7 @@ impl PacketIoWriter { self.enc.set_compression(threshold); } - pub async fn shutdown(&mut self) -> std::io::Result<()> { + pub(crate) async fn shutdown(&mut self) -> std::io::Result<()> { self.writer.shutdown().await?; Ok(()) } @@ -166,7 +166,7 @@ impl PacketIo { } } - pub fn split(self) -> (PacketIoReader, PacketIoWriter) { + pub(crate) fn split(self) -> (PacketIoReader, PacketIoWriter) { let (reader, writer) = tokio::io::split(self.stream); ( @@ -191,7 +191,7 @@ impl PacketIo { } } -pub fn varint_to_bytes(i: VarInt) -> BytesMut { +pub(crate) fn varint_to_bytes(i: VarInt) -> BytesMut { let mut buf = BytesMut::new(); let mut writer = (&mut buf).writer(); i.encode(&mut writer).unwrap(); diff --git a/tools/packet_inspector/src/shared_state.rs b/tools/packet_inspector/src/shared_state.rs index d21de63d6..0981a3026 100644 --- a/tools/packet_inspector/src/shared_state.rs +++ b/tools/packet_inspector/src/shared_state.rs @@ -7,12 +7,12 @@ use egui::Context; use packet_inspector::Packet; #[derive(serde::Deserialize, serde::Serialize)] -pub struct PacketFilter { +pub(crate) struct PacketFilter { inner: HashMap, } impl PacketFilter { - pub fn new() -> Self { + pub(crate) fn new() -> Self { let mut inner = HashMap::new(); for p in packet_inspector::STD_PACKETS.iter() { @@ -22,7 +22,7 @@ impl PacketFilter { Self { inner } } - pub fn get(&self, packet: &Packet) -> Option { + pub(crate) fn get(&self, packet: &Packet) -> Option { self.inner .iter() .find(|(k, _)| k.id == packet.id && k.side == packet.side && k.state == packet.state) @@ -30,27 +30,27 @@ impl PacketFilter { .copied() } - pub fn insert(&mut self, packet: Packet, value: bool) { + pub(crate) fn insert(&mut self, packet: Packet, value: bool) { self.inner.insert(packet, value); } - pub fn iter(&self) -> impl Iterator { + pub(crate) fn iter(&self) -> impl Iterator { self.inner.iter() } - pub fn iter_mut(&mut self) -> impl Iterator { + pub(crate) fn iter_mut(&mut self) -> impl Iterator { self.inner.iter_mut() } } -pub enum Event { +pub(crate) enum Event { StartListening, StopListening, PacketReceived, } #[derive(serde::Deserialize, serde::Serialize)] -pub struct SharedState { +pub(crate) struct SharedState { pub listener_addr: String, pub server_addr: String, pub autostart: bool, @@ -95,7 +95,7 @@ impl Default for SharedState { #[allow(unused)] impl SharedState { - pub fn new(ctx: Context) -> Self { + pub(crate) fn new(ctx: Context) -> Self { Self { ctx: Some(ctx), ..Self::default() @@ -126,7 +126,7 @@ impl SharedState { self } - pub fn send_event(&self, event: Event) { + pub(crate) fn send_event(&self, event: Event) { if let Some(sender) = &self.sender { sender.send(event); } diff --git a/tools/packet_inspector/src/tri_checkbox.rs b/tools/packet_inspector/src/tri_checkbox.rs index df9fbf088..ccd86fbf4 100644 --- a/tools/packet_inspector/src/tri_checkbox.rs +++ b/tools/packet_inspector/src/tri_checkbox.rs @@ -4,7 +4,7 @@ use egui::{ }; #[derive(Clone, Copy, Debug, PartialEq)] -pub enum TriCheckboxState { +pub(crate) enum TriCheckboxState { Enabled, Partial, Disabled, @@ -24,21 +24,21 @@ pub enum TriCheckboxState { /// # }); /// ``` #[must_use = "You should put this widget in an ui with `ui.add(widget);`"] -pub struct TriCheckbox<'a> { +pub(crate) struct TriCheckbox<'a> { checked: &'a mut TriCheckboxState, text: WidgetText, } #[allow(unused)] impl<'a> TriCheckbox<'a> { - pub fn new(checked: &'a mut TriCheckboxState, text: impl Into) -> Self { + pub(crate) fn new(checked: &'a mut TriCheckboxState, text: impl Into) -> Self { TriCheckbox { checked, text: text.into(), } } - pub fn without_text(checked: &'a mut TriCheckboxState) -> Self { + pub(crate) fn without_text(checked: &'a mut TriCheckboxState) -> Self { Self::new(checked, WidgetText::default()) } } diff --git a/tools/playground/Cargo.toml b/tools/playground/Cargo.toml index 16166f0f9..838f5a7a9 100644 --- a/tools/playground/Cargo.toml +++ b/tools/playground/Cargo.toml @@ -7,6 +7,9 @@ documentation.workspace = true license.workspace = true publish = false +[lints] +workspace = true + [dependencies] anyhow.workspace = true clap.workspace = true diff --git a/tools/playground/src/extras.rs b/tools/playground/src/extras.rs index fe4071e90..a00917847 100644 --- a/tools/playground/src/extras.rs +++ b/tools/playground/src/extras.rs @@ -5,7 +5,7 @@ use valence::prelude::*; /// Toggles client's game mode between survival and creative when they start /// sneaking. -pub fn toggle_gamemode_on_sneak( +pub(crate) fn toggle_gamemode_on_sneak( mut clients: Query<&mut GameMode>, mut events: EventReader, ) { diff --git a/tools/stresser/Cargo.toml b/tools/stresser/Cargo.toml index 60ec3ffe0..ca6a4d23e 100644 --- a/tools/stresser/Cargo.toml +++ b/tools/stresser/Cargo.toml @@ -9,6 +9,9 @@ documentation.workspace = true license.workspace = true publish = false +[lints] +workspace = true + [dependencies] anyhow.workspace = true clap.workspace = true