Generated catalog · 142 rules
Rust Doctor rules
Read from rust-doctor rules list --json, so this page states what the tool checks rather than what it once checked. Every rule ships at warn; raising or dropping one is your policy decision.
Security
13 rules- clippy::permissions_set_readonly_false Set explicit Unix permission bits instead of clearing readonly on Unix. Clippy · P1 · warn
- rust_doctor::cargo::unpinned_git_dependency Set rev to the full 40-character commit SHA intended by the project. Cargo health · P1 · warn
- rust_doctor::cargo::vulnerable_dependency Update the crate to a patched version with cargo update -p <crate>, or replace it when no patched release exists; the finding is read from the local RustSec database cargo audit or cargo deny keeps, never fetched. Cargo health · P1 · warn
- rust_doctor::repo::hardcoded_credential Remove the credential from the source and rotate it; the closed list judged here is AKIA, ghp_, github_pat_, sk-, xoxb-, BEGIN PRIVATE KEY blocks and the password of a postgres, mysql, mongodb or redis database URL, and the matched value is never republished by the report. Repository · P1 · warn
- rust_doctor::repo::secret_in_build_step Move the secret to the one step that needs it and compile in a step without it; publish with cargo publish --no-verify after verifying the package in a job that holds no OIDC permission, since id-token: write reaches every step of its job. Repository · P1 · warn
- rust_doctor::repo::tracked_secret_file Remove the file from version control with git rm --cached, rotate what it contains, and add its name to .gitignore so it stays out; the report names the path and never its contents. Repository · P1 · warn
- rust_doctor::source::disabled_jwt_validation Decode with a Validation that checks the signature and the key it expects; read unverified claims only to select that key, then verify the token before trusting any claim. Source kernel · P0 · warn
- rust_doctor::source::disabled_tls_verification Keep TLS verification enabled and configure the required trust roots or server name instead. Source kernel · P0 · warn
- rust_doctor::source::dynamic_shell_command Avoid the shell and pass values as separate Command arguments to a fixed program; otherwise apply shell-specific escaping at the trust boundary. Source kernel · P0 · warn
- rust_doctor::source::insecure_auth_cookie Keep http_only(true) on a session or auth cookie so page scripts cannot read it; expose to JavaScript only a value that grants nothing, such as a CSRF token. Source kernel · P1 · warn
- rust_doctor::source::permissive_cors List the origins allowed to call the API; never combine credentials with a mirrored or wildcard origin, and keep the permissive layer to local development. Source kernel · P1 · warn
- rust_doctor::source::secret_env_fallback Fail at startup when the secret is missing, with ? or an explicit error, instead of falling back to a literal or an empty value that ships in the binary. Source kernel · P1 · warn
- rust_doctor::source::sql_built_from_format Keep the SQL text constant and bind the value as a parameter: .bind() or query! with sqlx, push_bind() on a sqlx QueryBuilder, .bind::<T, _>() with diesel, the params argument with rusqlite and postgres. Source kernel · P1 · warn
Correctness
79 rules- clippy::absurd_extreme_comparisons Rewrite the comparison against the type's real range: as written it always yields the same answer. Clippy · P1 · warn
- clippy::almost_swapped Use std::mem::swap: the second assignment reads the value the first one already overwrote. Clippy · P1 · warn
- clippy::approx_constant Use the matching constant from std::f64::consts (or f32) instead of a truncated literal. Clippy · P1 · warn
- clippy::arc_with_non_send_sync Use Rc for single-threaded sharing, or make the inner value Send and Sync before sharing it across threads. Clippy · P1 · warn
- clippy::async_yields_async Await the inner future inside the block, so the caller receives its output rather than another future. Clippy · P1 · warn
- clippy::await_holding_lock Drop the guard before the await point, or use a lock designed to be held across await. Clippy · P1 · warn
- clippy::await_holding_refcell_ref Copy the borrowed value and drop the borrow before the await point. Clippy · P1 · warn
- clippy::bad_bit_mask Fix the mask or the constant: this bit-mask comparison can never be true, or is always true. Clippy · P1 · warn
- clippy::cast_slice_different_sizes Rebuild the slice pointer with std::ptr::slice_from_raw_parts and a length counted in the new element type. Clippy · P1 · warn
- clippy::char_indices_as_byte_indices Iterate with char_indices(), which yields byte offsets, before using the index to slice or index the string. Clippy · P1 · warn
- clippy::crosspointer_transmute Dereference the pointer or take the value's address instead of reinterpreting one as the other. Clippy · P2 · warn
- clippy::deprecated_semver Put a valid semantic version, such as "1.2.0", in the since field of #[deprecated]. Clippy · P1 · warn
- clippy::derive_ord_xor_partial_ord Derive both Ord and PartialOrd, or implement both by hand so they agree. Clippy · P1 · warn
- clippy::derived_hash_with_manual_eq Derive both Hash and PartialEq, or implement Hash by hand on the same fields PartialEq compares. Clippy · P1 · warn
- clippy::eager_transmute Move the transmute inside a closure passed to then(), so it only runs once the bound check has passed. Clippy · P1 · warn
- clippy::enum_clike_unportable_variant Give the enum a fixed-width repr such as u64, or keep every discriminant within 32 bits. Clippy · P1 · warn
- clippy::eq_op Compare against the value you meant: both operands are the same expression, so the result is fixed. Clippy · P1 · warn
- clippy::erasing_op Remove the operation or fix the operand: multiplying by zero or masking with zero always yields zero. Clippy · P1 · warn
- clippy::if_let_mutex Bind the first lock's result before the if let, so no guard is still held when the else branch locks again. Clippy · P1 · warn
- clippy::ifs_same_cond Change the repeated condition: the later branch is unreachable because an earlier one tests the same thing. Clippy · P1 · warn
- clippy::impl_hash_borrow_with_str_and_bytes Drop the Borrow<[u8]> impl, since str and [u8] hash differently and map lookups through it can fail. Clippy · P1 · warn
- clippy::impossible_comparisons Fix the bounds: no value satisfies both comparisons, so the condition is always false. Clippy · P1 · warn
- clippy::ineffective_bit_mask Drop the mask, which cannot change the comparison's result, or fix the constant it was meant to use. Clippy · P1 · warn
- clippy::infinite_iter Bound the iterator with take() or a terminating condition before consuming it. Clippy · P1 · warn
- clippy::inherent_to_string_shadow_display Remove the inherent to_string and let the Display implementation provide it. Clippy · P1 · warn
- clippy::inline_fn_without_body Remove #[inline] from the method declaration, or put it on the implementations that have a body. Clippy · P1 · warn
- clippy::inverted_saturating_sub Swap the operands: the guard proves the subtraction as written underflows. Clippy · P1 · warn
- clippy::invisible_characters Replace the invisible character with its \u{...} escape, or delete it if it is accidental. Clippy · P1 · warn
- clippy::iter_next_loop Iterate over the collection itself; iterating over next() runs the loop at most once. Clippy · P1 · warn
- clippy::iter_skip_zero Remove skip(0), or skip the number of elements you actually meant to. Clippy · P1 · warn
- clippy::iterator_step_by_zero Pass a non-zero step to step_by, which panics on zero. Clippy · P1 · warn
- clippy::lint_groups_priority Give the lint group a lower priority, such as priority = -1, so the individual lint levels in the same table override it. Clippy · P1 · warn
- clippy::match_str_case_mismatch Write the match arm in the case the scrutinee was converted to, or it can never match. Clippy · P1 · warn
- clippy::mem_replace_with_uninit Use std::mem::take, or replace with a real value, instead of an uninitialized or zeroed one. Clippy · P1 · warn
- clippy::min_max Fix the bound order, or use clamp(min, max): as nested, the result is always the same constant. Clippy · P1 · warn
- clippy::missing_transmute_annotations Name both types, as in transmute::<From, To>(value), so a change elsewhere cannot silently change what is reinterpreted. Clippy · P2 · warn
- clippy::mistyped_literal_suffixes Write the suffix with its type prefix, such as _i32 or _u8, instead of a digit group that looks like one. Clippy · P1 · warn
- clippy::modulo_one Remove the modulo by one, which is always zero, or use the divisor you meant. Clippy · P1 · warn
- clippy::mut_from_ref Take &mut self or a &mut argument, or return a shared reference: a &mut obtained from a & reference is unsound. Clippy · P1 · warn
- clippy::mut_mutex_lock Use get_mut when the mutex is already exclusively borrowed; locking it again can deadlock. Clippy · P2 · warn
- clippy::never_loop Remove the loop that never iterates twice, or fix its control flow. Clippy · P1 · warn
- clippy::non_octal_unix_permissions Write the permission bits as an octal literal, such as 0o644. Clippy · P1 · warn
- clippy::non_send_fields_in_send_ty Remove the unsafe Send implementation or ensure every field is safe to send between threads. Clippy · P1 · warn
- clippy::nonsensical_open_options Remove the option that contradicts the others, such as truncate without write access. Clippy · P1 · warn
- clippy::not_unsafe_ptr_arg_deref Mark the function unsafe and document its safety contract, or take a reference instead of a raw pointer. Clippy · P1 · warn
- clippy::option_env_unwrap Use env! for a variable required at build time, or handle the None option_env! returns when it is unset. Clippy · P1 · warn
- clippy::out_of_bounds_indexing Index within the array's length, or use get() to handle a range that may exceed it. Clippy · P1 · warn
- clippy::panic_in_result_fn A function that already returns Result should report the failure as Err instead of panicking. Clippy · P2 · warn
- clippy::panicking_overflow_checks Use checked_add or overflowing_add: in debug builds the addition panics before the comparison can detect overflow. Clippy · P1 · warn
- clippy::panicking_unwrap Remove the unwrap on the branch where the value is known to be None or Err, or fix the condition. Clippy · P1 · warn
- clippy::possible_missing_comma Add the missing comma between the array elements, or parenthesize the subtraction if it is intended. Clippy · P1 · warn
- clippy::rc_mutex Use RefCell inside Rc for single-threaded sharing, or Arc<Mutex<T>> when the value really crosses threads. Clippy · P2 · warn
- clippy::read_line_without_trim Trim the line before parsing it: read_line keeps the trailing newline, so the parse always fails. Clippy · P1 · warn
- clippy::recursive_format_impl Format the fields instead of self: formatting self inside its own Display or Debug impl recurses forever. Clippy · P1 · warn
- clippy::redundant_comparisons Remove the comparison implied by the other one. Clippy · P1 · warn
- clippy::reversed_empty_ranges Write the range from low to high and call rev() to iterate downward. Clippy · P1 · warn
- clippy::self_assignment Assign the value you meant: assigning a place to itself does nothing. Clippy · P1 · warn
- clippy::size_of_in_element_count Pass the element count, not a byte count: this function already multiplies by the element size. Clippy · P1 · warn
- clippy::suspicious_command_arg_space Pass each process argument separately instead of embedding spaces in one argument. Clippy · P2 · warn
- clippy::suspicious_splitn Pass a count of at least 2 to splitn, which with 0 or 1 never splits. Clippy · P1 · warn
- clippy::todo Replace todo! with the intended implementation or remove the reachable placeholder. Clippy · P2 · warn
- clippy::transmute_null_to_fn Use Option<fn()> and None instead of transmuting a null pointer into a function pointer. Clippy · P1 · warn
- clippy::transmuting_null Use Option<&T> and None instead of transmuting a null pointer into a reference. Clippy · P1 · warn
- clippy::undocumented_unsafe_blocks Precede the block with a `// SAFETY:` comment stating the invariant that makes each operation in it sound. Clippy · P2 · warn
- clippy::unimplemented Implement this code path or remove the reachable placeholder. Clippy · P1 · warn
- clippy::uninit_assumed_init Initialize the value, or keep it as MaybeUninit until every byte is written. Clippy · P1 · warn
- clippy::uninit_vec Fill the vector with real values, for instance vec![0; n] or resize, instead of set_len over uninitialized memory. Clippy · P1 · warn
- clippy::unit_cmp Compare the values the expressions produce, not unit, which always compares equal. Clippy · P1 · warn
- clippy::unit_hash Hash the value you meant: hashing unit adds nothing to the hasher. Clippy · P1 · warn
- clippy::unit_return_expecting_ord Return the sort key from the closure: a trailing semicolon makes it return unit. Clippy · P1 · warn
- clippy::unreachable Make the remaining case explicit or return an error; an unreachable! that is reached aborts the process. Clippy · P2 · warn
- clippy::unsound_collection_transmute Convert the elements with into_iter().map(...).collect() instead of transmuting the collection. Clippy · P1 · warn
- clippy::unused_io_amount Use write_all or read_exact, or handle the byte count write and read return. Clippy · P1 · warn
- clippy::useless_attribute Move the attribute to the item it should govern, or make it an inner #! attribute if it was meant for the module. Clippy · P1 · warn
- clippy::vec_resize_to_zero Use clear() to empty the vector, or swap the resize arguments if you meant to grow it. Clippy · P1 · warn
- clippy::while_immutable_condition Update a variable of the condition inside the loop, or the loop never ends once entered. Clippy · P1 · warn
- clippy::wrong_transmute Transmute only between types whose values mean the same thing, or convert with the dedicated method instead. Clippy · P1 · warn
- clippy::zst_offset Remove pointer arithmetic on a zero-sized type, which never moves the pointer. Clippy · P1 · warn
- rust_doctor::source::block_in_place_on_current_thread Run the test or the runtime with flavor = "multi_thread", or move the blocking work into tokio::task::spawn_blocking; tokio documents that block_in_place panics on a current-thread runtime. Source kernel · P1 · warn
Reliability
17 rules- clippy::exit Return an error to the caller and let the entry point decide the exit status. Clippy · P2 · warn
- clippy::expect_used Propagate the error with ? or handle the missing value explicitly instead of panicking. Clippy · P3 · warn
- clippy::indexing_slicing Use get or get_mut and handle the absent element instead of indexing, which panics out of bounds. Clippy · P3 · off
- clippy::mem_forget Avoid leaking a value with drop semantics; use an explicit ownership or lifetime strategy. Clippy · P2 · warn
- clippy::panic Return an error instead of aborting the process on an input the caller can recover from. Clippy · P3 · warn
- clippy::string_slice Use get on the string range and handle the absent slice; byte indexing panics inside a UTF-8 character. Clippy · P3 · off
- clippy::unwrap_used Propagate the error with ? or provide a default instead of panicking on the absent value. Clippy · P3 · warn
- clippy::zombie_processes Wait on the child process or otherwise reap it before the handle is dropped. Clippy · P2 · warn
- rust_doctor::cargo::permissive_lint_table The allow hides the rule's sites from this scan. Remove the entry and fix what it silences, switch the rule off in rust-doctor.toml, or add `# rust-doctor: allow(rust_doctor::cargo::permissive_lint_table) -- reason` above the key. Cargo health · P3 · warn
- rust_doctor::cargo::permissive_rustflags Remove the flag from .cargo/config.toml and fix what it silences; the closed list judged here is --cap-lints allow, -A warnings and -C overflow-checks=off, each of which disables a check for every build of this workspace. Cargo health · P2 · warn
- rust_doctor::cargo::release_debug_symbols Set strip = "symbols" or remove debug from [profile.release]: full debug info ships absolute build paths inside the binary. Only [profile.release] itself is judged; profiles inheriting from it are not resolved. Cargo health · P3 · warn
- rust_doctor::cargo::unbounded_registry_dependency Replace the unbounded version requirement with the minimum compatible version intended by the project. Cargo health · P3 · warn
- rust_doctor::cargo::unchecked_release_overflow Set overflow-checks = true under [profile.release] so integer overflow panics instead of wrapping silently; the measured cost is a few percent on integer-heavy code, which is the tradeoff this finding asks you to decide. Cargo health · P3 · warn
- rust_doctor::source::block_on_in_async Await the future instead; to run blocking work, move it to tokio::task::spawn_blocking, and build a runtime only in synchronous code such as main or a dedicated thread. Source kernel · P2 · warn
- rust_doctor::source::blocking_call_in_async Use the async equivalent (tokio::fs, tokio::time::sleep, tokio::process, reqwest's async client) or move the call into tokio::task::spawn_blocking; the rule also follows a call into a synchronous helper of the same file, four helpers deep, and reports it at the call made from async code. Source kernel · P2 · warn
- rust_doctor::source::unchecked_http_status Call .error_for_status()? before reading the body, or match on .status() and handle the error payload. Source kernel · P2 · warn
- rust_doctor::structure::crate_level_allow Scope the allow to the item that needs it; a file-wide or module-wide exemption, reasoned or not, also silences every future finding in its reach. Structure · P2 · warn
Performance
10 rules- clippy::format_collect Write into one String with write! or push_str instead of allocating one String per item. Clippy · P3 · warn
- clippy::large_types_passed_by_value Pass the large value by reference to avoid copying it at every call. Clippy · P3 · warn
- clippy::manual_memcpy Use copy_from_slice or clone_from_slice instead of copying element by element. Clippy · P3 · warn
- clippy::ptr_arg Take &[T] or &str so callers can pass any borrowed slice without owning one first. Clippy · P3 · warn
- clippy::rc_buffer Share the slice itself with Rc<str> or Rc<[T]> instead of wrapping an owned buffer. Clippy · P3 · warn
- clippy::redundant_allocation Remove the inner allocation; one pointer indirection is enough. Clippy · P2 · warn
- clippy::stable_sort_primitive Use sort_unstable on primitives; stability carries no meaning and costs an allocation. Clippy · P3 · warn
- clippy::unnecessary_to_owned Pass the borrowed value directly; the callee never needs the owned copy. Clippy · P3 · warn
- clippy::useless_vec Use an array or a slice literal; this value never needs a heap allocation. Clippy · P3 · warn
- clippy::vec_init_then_push Build the vector with the vec! literal so it is allocated once at its final size. Clippy · P3 · warn
Dependencies
7 rules- rust_doctor::cargo::duplicate_major_versions Align the requirement your manifest controls, or bump the dependency the message names so it moves to the version you require. Cargo health · P2 · warn
- rust_doctor::cargo::missing_lockfile Commit Cargo.lock next to the manifest so every build of this binary resolves the same dependency versions. Cargo health · P2 · warn
- rust_doctor::cargo::path_dependency_outside_workspace Vendor the crate inside the workspace or publish it; a path leaving the workspace only resolves on the author's machine. Cargo health · P1 · warn
- rust_doctor::cargo::test_only_dependency Move the entry to [dev-dependencies]: only the test suite references it, and every consumer of the library compiles it anyway. Cargo health · P2 · warn
- rust_doctor::cargo::unmaintained_dependency Replace the crate with a maintained alternative the advisory names, or vendor and own it; the finding is read from the local RustSec database cargo audit or cargo deny keeps, never fetched. Cargo health · P2 · warn
- rust_doctor::cargo::unused_dependency Remove the entry no source references, or switch this rule off with --rule or rust-doctor.toml for a crate needed for linking alone; references made only through macro expansion or doctests are not seen. Cargo health · P2 · warn
- rust_doctor::repo::ignored_lockfile Remove Cargo.lock from .gitignore and commit it, so CI and every clone of this binary resolve the dependency versions that were tested. Repository · P2 · warn
Maintainability
16 rules- clippy::dbg_macro Remove dbg! or replace it with intentional logging. Clippy · P3 · warn
- clippy::missing_safety_doc Document in a `# Safety` section the invariants the caller must uphold before calling. Clippy · P3 · warn
- clippy::print_stderr Write to a caller-provided writer or a logger instead of hard-wiring stderr. Clippy · P3 · warn
- clippy::print_stdout Write to a caller-provided writer or a logger instead of hard-wiring stdout. Clippy · P3 · warn
- clippy::too_many_arguments Group the related parameters into a struct so the signature names what it takes. Clippy · P3 · warn
- clippy::type_complexity Name the nested type with a type alias or a dedicated struct so signatures say what they carry. Clippy · P3 · warn
- clippy::unused_async Remove the async marker, or await the work the function was meant to drive. Clippy · P3 · warn
- rust_doctor::repo::unignored_build_output Add the target directory to .gitignore so build artifacts stay out of the repository; the directory judged is Cargo's, including a custom target-dir set in .cargo/config.toml, and any ignore source git honors counts. Repository · P3 · warn
- rust_doctor::structure::complex_function Split the branching into smaller functions, or flatten it with early returns, so one reading holds the whole path. Structure · P3 · warn
- rust_doctor::structure::duplicate_function_body Keep one definition and call it from the other sites, or make what differs between them a parameter. Structure · P3 · warn
- rust_doctor::structure::near_duplicate_function_body Factor the shared shape into one function and pass what differs, or keep both and record why they must stay apart. Structure · P3 · warn
- rust_doctor::structure::orphan_module_file Declare the file with a mod declaration, or delete it: Cargo compiles no file the module tree does not reach. Structure · P3 · warn
- rust_doctor::structure::oversized_unit Split the file, function, impl block or module along its responsibilities before growth makes the split harder. Structure · P3 · warn
- rust_doctor::structure::stacked_allow_attribute Keep the one exemption the item actually needs and fix what the others hide; attributes produced by cfg_attr are not counted here. Structure · P3 · warn
- rust_doctor::structure::unreasoned_allow_attribute Fix what the lint reports, or keep the allow and state why with reason = "..." so the exemption survives review. Structure · P3 · warn
- rust_doctor::structure::unreferenced_feature Delete the feature nothing reads, or declare the one a cfg already gates; switch this rule off for a stub deliberately kept as published surface. Structure · P3 · warn