Skip to main content

WoW Lab

Tidy rules

206 rules loaded from the same runtime registry and configuration used by cargo tidy.

Rust Ast (140)§

rust_alloc_in_loop
Flag format!(), format_args!(), .to_string(), and .push_str() inside loops.
Severity: Medium
rust_ambient_syscall
Flag ambient I/O, clock, env, and entropy calls in library code.
Severity: Medium
rust_asref_bound_on_type
Flag struct/enum generic parameters bounded by AsRef<…> and stored in fields.
Severity: Low
rust_assert_side_effects
Ban compound assignments (+=, -=) inside debug_assert! macros.
Severity: High
rust_assoc_fn_no_self
Flag inherent associated fns that neither take nor return the impl type — make them free functions.
Severity: Low
rust_async_loop_no_yield
Flag loops in async contexts whose bodies never .await (CPU-bound work without yield points).
Severity: Low
rust_attr_order
Require item attributes to be ordered as docs, derives, then other attributes.
Severity: Low · Auto-fixable
rust_bool_params
Flag functions with threshold+ bool parameters (error-prone API design).
Severity: Medium
rust_build_rs_external_tool
Flag build.rs usage of external tools, hard-required env vars, and build-time binding generation.
Severity: Medium
rust_builder_conventions
Enforce builder conventions: chainable by-value setters named x(), a final build(), and X::builder() instead of XBuilder::new().
Severity: Medium
rust_builder_fallible_setter
Flag builder setters returning Result — setters accept infallibly, validation belongs in build().
Severity: Medium
rust_builder_param
Flag parameters typed *Builder/*Factory — ask for impl Fn() -> T instead.
Severity: Low
rust_busy_wait
Flag spin loops polling try_recv/try_lock/atomics without sleeping, yielding, or blocking.
Severity: Medium
rust_catch_unwind
Require // PANIC-BOUNDARY: comment on catch_unwind calls.
Severity: High
rust_clone_in_loop
Flag .clone() calls inside loop bodies (potential O(n) allocations).
Severity: Medium
rust_closure_dense_method_chain
Flag method-call chains containing at least the configured number of inline closure arguments.
Severity: Medium
rust_closure_param_position
Flag closure parameters that are not last, and fns taking more than one closure.
Severity: Low
rust_collection_new_in_loop
Flag collection constructors (Vec::new(), vec![], with_capacity, ...) bound via let inside loops.
Severity: Medium
rust_collection_trait_completeness
Require collection trait counterparts: iter() needs impl IntoIterator for &T, iter_mut() needs impl IntoIterator for &mut T, and FromIterator/Extend come in pairs.
Severity: Low
rust_concrete_io_param
Flag fn parameters typed as concrete I/O handles like File or TcpStream.
Severity: Low
rust_consecutive_field_asserts
Flag consecutive assertions on fields of the same receiver.
Severity: Low
rust_const_fn_candidate
Flag pure functions that could be const fn.
Severity: Low · Auto-fixable
rust_const_needs_doc
Require a doc or line comment on private consts and statics holding literal values.
Severity: Low
rust_conversion_self_convention
Enforce C-CONV receivers: as_/to_ methods borrow (&self), into_ methods consume (self).
Severity: Medium
rust_ctor_new
Flag public structs with Default but no pub fn new — constructors are static inherent methods (C-CTOR).
Severity: Low
rust_ctor_param_count
Flag constructors with too many parameters or runs of identically-typed primitives — cascade construction through helper types.
Severity: Medium
rust_cyclomatic_complexity
Flag functions with cyclomatic complexity > threshold.
Severity: Medium
rust_dbg
Ban dbg!() macro calls in production code.
Severity: Medium · Auto-fixable
rust_deep_exit
Ban std::process::exit() in library code.
Severity: High
rust_deeply_nested_types
Flag type annotations with > 3 levels of generic nesting.
Severity: Low
rust_default_hasher
Flag std HashMap/HashSet types and constructors that use the default SipHash hasher.
Severity: Low
rust_derive_order
Require traits inside derive attributes to be sorted alphabetically.
Severity: Low · Auto-fixable
rust_dll_boundary_types
Flag String, Vec, Box, dyn objects, TypeId, and Instant in extern "C" signatures.
Severity: High
rust_doc_errors_section
Require a # Errors section on documented pub fns returning Result.
Severity: Medium
rust_doc_panics_section
Require a # Panics section on documented pub fns that can panic.
Severity: Medium
rust_drop_panic
Ban panic!, .unwrap(), .expect() inside impl Drop.
Severity: High
rust_dup_expressions
Flag identical sub-expressions like x == x, a - a, b && b.
Severity: High
rust_dyn_wrapper_in_api
Flag Rc<dyn …>/Arc<dyn …>/Box<dyn …> in pub fn params, returns, and pub struct fields.
Severity: Low
rust_error_missing_traits
Require Display and std::error::Error on public *Error types.
Severity: Medium
rust_error_type_unit
Flag Result<T, ()> return types — use a real error type.
Severity: Medium
rust_excessive_float_precision
Flag float literals with more significant digits than the type can represent.
Severity: Low
rust_exotic_numeric_api
Flag Saturating/Wrapping/NonZero* in pub fn signatures.
Severity: Low
rust_expect_in_result_test
Disallow expect_that! in tests returning Result.
Severity: Low
rust_expect_message
Require .expect() to have a meaningful message, not generic ones.
Severity: Low
rust_fallible_in_iterator
Flag .unwrap()/.expect() inside iterator adapter closures.
Severity: Medium
rust_ffi_in_core
Flag #[no_mangle] extern "C" exports and #[repr(C)] raw-pointer structs in non-FFI crates.
Severity: Medium
rust_ffi_thin_glue
Flag extern "C" functions in *-ffi crates whose body exceeds the line threshold.
Severity: Low
rust_filesystem_boundary
Require filesystem and native-path access to go through wowlab-fs.
Severity: High
rust_floating_point_eq
Flag direct ==/!= comparison on f32/f64 values.
Severity: High
rust_foreign_reexports
Flag pub use re-exports of items from foreign crates.
Severity: Medium
rust_format_in_log
Flag runtime string building (format!, .to_string(), {} placeholders) in logging macros.
Severity: Low
rust_from_instead_of_as
Flag as casts on suffixed literals — use From/Into instead.
Severity: Low · Auto-fixable
rust_future_send_assert
Require a compile-time Send assertion for every explicit impl Future in the same file.
Severity: Low
rust_getter_prefix
Flag methods named get_something — Rust getters are named after the field (C-GETTER).
Severity: Low
rust_glob_reexport
Flag pub use foo::* glob re-exports outside platform-cfg'd HAL forwarding.
Severity: Medium
rust_global_state
Flag static items with interior mutability and all thread_local! state.
Severity: Medium
rust_gtest_required
Require every native Rust test to use the googletest test attribute.
Severity: Medium
rust_impl_into_for_owned
Flag impl Into<T> for X — implement From<X> for T instead (gives Into for free).
Severity: Medium
rust_impl_member_order
Require inherent impl members to follow the canonical category and visibility order.
Severity: Medium · Auto-fixable
rust_indexed_element_asserts
Flag consecutive assertions on indexed elements of the same collection.
Severity: Low
rust_infallible_from_weak
Flag impl From<weak> next to fallible construction of the same type.
Severity: Medium
rust_inherent_before_trait_impl
Require an inherent impl to precede trait impls for the same local type.
Severity: Low
rust_inline_test_module_size
Flag #[cfg(test)] mod blocks spanning more than threshold lines.
Severity: Low
rust_large_async_local
Flag by-value [T; N] locals and parameters over threshold bytes inside async fns and blocks.
Severity: Medium
rust_large_enum_variant
Flag enum variants that are much larger than others (should Box the large variant).
Severity: Medium
rust_large_fn_params
Flag functions with > threshold parameters.
Severity: Medium
rust_large_stack_array
Flag large fixed-size arrays on the stack (>threshold bytes). WASM has limited stack.
Severity: High
rust_log_in_loop
Flag logging macro invocations inside loop bodies in library code.
Severity: Low
rust_long_compound_name
Flag type definitions whose CamelCase name compounds more than threshold words.
Severity: Low
rust_loop_to_while
Flag loop { if cond { break; } ... } — use while instead.
Severity: Low
rust_lossy_cast
Flag as casts to types that lose precision (f32, u8, u16, i8, i16).
Severity: Medium
rust_macro_hidden_items
Flag fixed-name pub items emitted from quote! bodies.
Severity: Medium
rust_macro_third_party_path
Flag absolute third-party paths in macro bodies and hardcoded host-crate paths in macro_rules!.
Severity: Medium
rust_magic_numbers
Flag unnamed numeric literals — extract into named constants.
Severity: Low
rust_manual_async_fn
Flag non-async functions that return impl Future by wrapping the whole body in one async block.
Severity: Low
rust_manual_error_impl
Reject hand-written Display and Error implementations for *Error types.
Severity: Low
rust_manual_float_epsilon
Disallow manual floating-point epsilon assertions and local assert-near helpers.
Severity: Medium
rust_map_err_pure_wrap
Flag .map_err(...) that only wraps the error in another type — implement From and let ? convert.
Severity: Low
rust_max_fn_lines
Flag functions longer than threshold lines.
Severity: Medium
rust_max_nesting
Flag nesting depth > threshold levels.
Severity: Medium
rust_mem_forget
Require LEAK or SAFETY comment on std::mem::forget() calls.
Severity: High
rust_missing_assert_message
Require a message argument on assert!, assert_eq!, assert_ne!.
Severity: Low
rust_missing_capacity
Flag collections built with new()/default() then grown inside a loop over a sized source.
Severity: Low
rust_missing_debug
Require #[derive(Debug)] on public structs and enums.
Severity: Low · Auto-fixable
rust_missing_error_context
Flag .map_err(|_| ...) that discards the original error.
Severity: Medium
rust_mod_order
Require contiguous module-declaration blocks to be alphabetically sorted.
Severity: Low · Auto-fixable
rust_module_prefix_in_name
Flag pub type definitions whose name repeats the module name as a prefix (FooId in foo.rs).
Severity: Low
rust_multiple_inherent_impl
Flag multiple impl Foo blocks for the same type in one file.
Severity: Low
rust_mutex_in_async
Flag std::sync::Mutex usage in async functions (use tokio::sync::Mutex).
Severity: High
rust_native_escape_hatches
Require unsafe fn from_native, into_native, and to_native on public raw-pointer wrapper structs.
Severity: Low
rust_nested_smart_pointers
Flag directly nested heap pointers (Arc<Box<T>>, Rc<Rc<T>>, ...) plus Arc<Vec<T>>/Arc<String>.
Severity: Medium
rust_newtype_pub_field
Flag pub single-field structs exposing a pub primitive/&str/String field.
Severity: Medium
rust_non_exhaustive_on_public
Flag public enums without #[non_exhaustive] — prevents breaking changes when adding variants.
Severity: Medium
rust_nonsend_across_await
Flag Rc/RefCell bindings in async code when an .await occurs later in the same block.
Severity: Medium
rust_ok_or_eager
Flag .ok_or()/.unwrap_or() with eagerly evaluated arguments.
Severity: Low · Auto-fixable
rust_owned_ref_param
Flag fn parameters typed &String, &PathBuf, &Vec<T>, &OsString.
Severity: Medium
rust_padding
Require blank-line padding between distinct statement groups.
Severity: Low · Auto-fixable
rust_panic
Ban unimplemented!(), todo!(), and message-less panic!() in library code.
Severity: High
rust_panic_in_result_fn
Ban panic!, .unwrap(), .expect() in functions returning Result.
Severity: High
rust_panic_message
Require a message on unreachable! and debug_assert!*.
Severity: Medium
rust_param_order_consistency
Flag fns whose shared parameters appear in a different order than an earlier fn in the file.
Severity: Low
rust_println
Ban println!/eprintln!/print!/eprint! in library code.
Severity: Medium · Auto-fixable
rust_proc_macro_thin_shim
Require proc-macro entry points to be thin impl_crate::name(arg.into()).into() shims.
Severity: Low
rust_pub_api_docs
Require doc comments on public items.
Severity: Low
rust_pub_api_foreign_types
Flag foreign crate types leaked through pub fn signatures, fields, and type aliases.
Severity: Low
rust_pub_api_generic_nesting
Flag pub fn signatures, pub struct fields, and pub type aliases nesting one local generic instantiation inside another (e.g. Service<Backend<Store>>).
Severity: Low
rust_pub_api_smart_pointers
Flag Rc/Arc/Box/RefCell/Cell/Mutex/RwLock as the outermost type of pub fn params, returns, and pub struct fields.
Severity: Medium
rust_pub_use_grouping
Require public re-exports from the same origin to be adjacent.
Severity: Low · Auto-fixable
rust_pub_use_position
Require top-level public imports to follow plain imports in a separate block.
Severity: Low · Auto-fixable
rust_public_error_enum
Flag pub enum named *Error/*ErrorKind — expose a situation-specific error struct with a private kind enum instead.
Severity: Medium
rust_range_over_rangebounds
Flag pub fn parameters typed Range<T> — accept impl RangeBounds<T> instead.
Severity: Low
rust_raw_rng
Flag raw rng() < chance stochastic gating — use proc_chance(rng, chance).
Severity: Medium
rust_raw_spell_id
Ban raw spell IDs and generated-constant re-aliases in spec hooks.
Severity: High
rust_recursive_fn
Flag direct self-recursion (stack overflow risk, especially in WASM).
Severity: High
rust_redundant_field_names
Flag Foo { x: x } — use shorthand Foo { x } instead.
Severity: Low · Auto-fixable
rust_reinvented_constant
Flag local constants that reinvent shared numeric constants.
Severity: Low
rust_sensitive_debug
Flag #[derive(Debug)] on structs with sensitive fields like password.
Severity: High
rust_single_item_path
Flag pub use re-exports that duplicate paths already public through a sibling pub mod.
Severity: Medium
rust_string_error
Reject String and &str as function error types.
Severity: Medium
rust_subtractive_feature_cfg
Flag #[cfg(not(feature = "..."))] on pub items — features must be additive.
Severity: Medium
rust_suspicious_enum_default
Flag #[derive(Default)] on enums without explicit #[default] variant.
Severity: Medium
rust_tautological_assert
Flag test asserts comparing a constant against a literal (or literal vs literal).
Severity: Low
rust_thiserror_qualified
Require thiserror derives to use the qualified thiserror::Error path.
Severity: Low · Auto-fixable
rust_trait_logic_not_inherent
Flag substantial logic in impls of locally-defined traits when the type has no same-named inherent method.
Severity: Low
rust_transmute_in_safe_fn
Flag transmute inside a safe pub fn.
Severity: High
rust_transmute_usage
Require SAFETY comment on std::mem::transmute calls.
Severity: High
rust_type_def_ordering
Flag impl blocks that appear before their type definition.
Severity: Low
rust_unbalanced_crate_root
Flag lib.rs roots that are flat item dumps (too many pub items) or empty shells (no pub items over many pub modules).
Severity: Low
rust_unchecked_indexing
Flag container[expr] indexing with non-literal indices.
Severity: Low
rust_unnecessary_collect
Flag .collect().iter() — remove the intermediate collection.
Severity: Low
rust_unsafe_comment
Require // SAFETY: comment on unsafe blocks.
Severity: High
rust_unsafe_fn_safety_doc
Require a # Safety doc section or // SAFETY: comment on every unsafe fn.
Severity: High
rust_unsafe_without_ub_surface
Flag unsafe fn with no raw-pointer surface and no unsafe operations in the body.
Severity: Low
rust_unwrap_in_lib
Ban .unwrap() in library code.
Severity: Medium
rust_vec_init_then_push
Flag Vec::new() immediately followed by .push() calls (use vec![] or with_capacity).
Severity: Low
rust_vec_string_field
Flag non-pub struct fields typed Vec<String> or Vec<Vec<T>>.
Severity: Low
rust_weasel_words
Flag type definitions whose name contains a weasel word like Manager, Service, or Factory.
Severity: Medium
rust_where_clauses
Require type-parameter trait bounds to use where clauses.
Severity: Low
rust_wildcard_imports
Ban use foo::* outside tests and preludes.
Severity: Medium
rust_yoda_conditions
Flag reversed comparisons like 0 == x — prefer x == 0.
Severity: Low

Rust Line (35)§

rust_abs_home_path
Ban hardcoded home directory paths like /Users/ or /home/ in string literals.
Severity: Medium
rust_aligned
Enforce column alignment in regions marked with // #t:aligned.
Severity: Low · Auto-fixable
rust_allow_reason
Require a reason = "..." or comment explaining why #[allow(...)]/#[expect(...)] is used.
Severity: Low
rust_alphabetical
Enforce sorted ordering in regions marked with tidy-alphabetical-start.
Severity: Low · Auto-fixable
rust_ambiguous_unicode
Ban Unicode characters visually confusable with ASCII (homoglyphs).
Severity: High
rust_banner_comments
Disallow decorative separator and framed banner comments.
Severity: Low · Auto-fixable
rust_bidirectional_unicode
Ban Unicode bidi control characters that enable trojan-source attacks.
Severity: High
rust_box_leak
Require SAFETY or LEAK comment on Box::leak() calls.
Severity: High
rust_box_vec
Ban Box<Vec<T>>, Box<String>, Box<Box<T>> (unnecessary double indirection).
Severity: Medium · Auto-fixable
rust_cfg_not_test
Flag #[cfg(not(test))] — use dependency injection or feature flags instead.
Severity: Medium
rust_comment_space
Require a space after // in comments (//bad -> // good).
Severity: Low · Auto-fixable
rust_commented_code
Detect blocks of commented-out code (2+ consecutive lines).
Severity: Low
rust_deny_warnings
Ban #![deny(warnings)] — breaks on compiler upgrades.
Severity: Medium · Auto-fixable
rust_doc_comment_period
Require doc comments to end with proper punctuation.
Severity: Low
rust_doc_inline_reexport
Require #[doc(inline)] on local re-exports and forbid it on external ones.
Severity: Low
rust_doc_param_table
Ban # Parameters/# Arguments/# Params sections in doc comments.
Severity: Low
rust_docref
Validate // docref:start/// docref:end code-embed markers (pairing, ids, no blank lines inside).
Severity: High
rust_duplicate_words
Flag repeated words in comments like the the or is is.
Severity: Low · Auto-fixable
rust_expect_over_allow
Flag #[allow(...)] in hand-written code — use #[expect(..., reason = "...")] instead.
Severity: Medium
rust_ffi_crate_naming
Require -ffi naming for crates exporting C symbols and -sys naming for crates linking foreign C items.
Severity: Low
rust_first_doc_sentence
Require the first doc sentence to end on the first line within a word budget.
Severity: Low
rust_forbidden_deps
Ban std::net and std::thread in WASM-targeted crates.
Severity: High
rust_hardcoded_url
Flag hardcoded URLs in source code (should use config/env).
Severity: Medium
rust_imperative_talent_wiring
Require talent-gated config wiring to use declarative config rows.
Severity: Medium
rust_log_named_events
Flag event!(...) invocations without a name: argument before the level.
Severity: Low
rust_module_docs
Require //! module docs at the top of lib.rs and mod.rs files.
Severity: Medium
rust_no_prelude
Ban prelude module declarations and prelude.rs/prelude/mod.rs files.
Severity: High
rust_proc_macro_justification
Require a // WHY-PROC: comment above every proc-macro attribute.
Severity: Medium
rust_spec_module_layout
Enforce the minimum directory layout for engine-content spec hook modules, including define_game_bug! placement in bugs.rs.
Severity: Medium
rust_static_mut
Ban static mut declarations — use AtomicT, Mutex, or OnceLock.
Severity: High
rust_style
Enforce no trailing whitespace, no tabs, no CRLF line endings.
Severity: Low · Auto-fixable
rust_tidy_directives
Enforce file-wide #t directives at top of file with a blank line separator.
Severity: Low
rust_todo
Require TODO/FIXME/HACK/XXX to have parenthesized context.
Severity: Low
rust_too_many_lines_in_file
Flag files exceeding threshold lines.
Severity: Medium
rust_unsafe_impl_send
Flag unsafe impl Send/Sync without a // SAFETY: comment, and any generic (blanket) form.
Severity: High

Rust Workspace (4)§

rust_duplicate_strings
Find long string literals repeated across files; full-workspace runs are authoritative.
Severity: Low
rust_param_clump
Find maximal parameter groups repeated across functions; full-workspace runs are authoritative.
Severity: Low
rust_similar_fns
Find exact and near duplicate function bodies; full-workspace runs are authoritative.
Severity: Low
rust_similar_structs
Find exact, near, and containment duplicate named-field structs; full-workspace runs are authoritative.
Severity: Low

Toml (26)§

toml_ambiguous_unicode
Ban Unicode characters in TOML that are visually confusable with ASCII.
Severity: High
toml_cargo_app_error_crates
Restrict application error crates to application crates and forbid mixing them.
Severity: Medium
toml_cargo_bench_debug
Require [profile.bench] to enable debug info when any workspace member ships benchmarks.
Severity: Low
toml_cargo_crates_in_workspace
Require every crate directory to be a workspace member and ban path = ... dependencies in member manifests.
Severity: Medium
toml_cargo_edition
Require the workspace and non-inheriting members to target at least the configured Rust edition, with the matching virtual-workspace resolver.
Severity: Medium
toml_cargo_feature_names
Flag Cargo feature names with use-/with- prefixes or -support suffixes.
Severity: Low
toml_cargo_feature_no_std
Ban subtractive no-std Cargo features; provide an additive std feature instead.
Severity: Medium
toml_cargo_flat_layout
Require every crate to be a direct child of crates/ and never nested inside another crate.
Severity: High
toml_cargo_mimalloc_apps
Require binary crates to depend on mimalloc and install it as the global allocator.
Severity: Low
toml_cargo_msrv
Require the workspace to declare rust-version and members to inherit it instead of overriding it.
Severity: Low
toml_cargo_proc_macro_crate_helper
Ban the proc-macro-crate helper dependency in Cargo manifests.
Severity: Low
toml_cargo_target_cpu
Require a -C target-cpu rustflags entry in .cargo/config.toml for workspaces with native binaries.
Severity: Low
toml_cargo_tempfile_dependency
Ban direct tempfile dependencies outside the shared filesystem implementation.
Severity: High
toml_cargo_workspace_dep_features
Flag [workspace.dependencies] entries that enable features outside the allowlist.
Severity: Low
toml_cargo_workspace_inheritance
Require member crates to inherit dependency versions and shared package metadata from the workspace root.
Severity: Medium
toml_cargo_workspace_lints
Require the workspace to enable the standard rust/clippy lint set and members to inherit it via [lints] workspace = true.
Severity: Medium
toml_manifest_comment_blocks
Require concise, single-line standalone comments in engine manifests.
Severity: Low · Auto-fixable
toml_manifest_field_order
Require identity fields to appear first in manifest definition tables.
Severity: Low · Auto-fixable
toml_manifest_format
Require engine manifests to match the canonical Taplo format.
Severity: Low · Auto-fixable
toml_manifest_references
Require symbolic aura, spell, talent, and auto-attack references to resolve.
Severity: High
toml_manifest_repository
Require a closed, unambiguous manifest component graph and unique spec IDs.
Severity: High
toml_manifest_schema
Require every root manifest to compose and deserialize through the canonical schema.
Severity: High
toml_manifest_schema_version
Require every root manifest to declare the current schema version explicitly.
Severity: High
toml_manifest_section_contiguity
Require each top-level manifest section to occupy one contiguous region.
Severity: Medium
toml_manifest_shared_anchors
Require shared includes to anchor every order-sensitive section they contribute.
Severity: High
toml_validity
Reject TOML syntax errors and semantic conflicts such as duplicate keys.
Severity: High

Workspace (1)§

toml_cargo_unused_deps
Flag workspace-member dependencies that are never referenced by any Rust compile target.
Severity: Medium