Type object
File match clippy.toml **/clippy.toml .clippy.toml **/.clippy.toml
Schema URL https://catalog.lintel.tools/schemas/rust/clippy/latest.json

Validate with Lintel

npx @lintel/lintel check
Type: object

Configuration file for Clippy, the Rust linter.

Overview

Clippy can be configured using a clippy.toml or .clippy.toml file at the project root. The configuration file is searched for in this order:

  1. The directory specified by CLIPPY_CONF_DIR
  2. The directory specified by CARGO_MANIFEST_DIR
  3. The current directory

Configuration uses simple variable = value mapping:

avoid-breaking-exported-api = false
disallowed-names = ["toto", "tata", "titi"]
msrv = "1.70.0"

For array options with defaults, use ".." to extend the default list rather than replacing it:

# default of disallowed-names is ["foo", "baz", "quux"]
disallowed-names = ["bar", ".."] # -> ["bar", "foo", "baz", "quux"]

See the Clippy Configuration guide for full details on configuring Clippy.

All lint configuration options listed here are sourced from the Lint Configuration reference. This schema will be updated as that source page is updated.

Properties

absolute-paths-allowed-crates string[]

Which crates to allow absolute paths from.

Affected lints: absolute_paths

Default:
[]
absolute-paths-max-segments integer

The maximum number of segments a path can have before being linted.

Affected lints: absolute_paths

Default: 2
min=0
accept-comment-above-attributes boolean

Whether to accept a safety comment above the attributes for an unsafe block.

Affected lints: undocumented_unsafe_blocks

Default: true
accept-comment-above-statement boolean

Whether to accept a safety comment above the statement containing an unsafe block.

Affected lints: undocumented_unsafe_blocks

Default: true
allow-comparison-to-zero boolean

Don't lint when comparing the result of a modulo operation to zero.

Affected lints: modulo_arithmetic

Default: true
allow-dbg-in-tests boolean

Whether dbg! should be allowed in test functions or #[cfg(test)] code.

Affected lints: dbg_macro

Default: false
allow-exact-repetitions boolean

Whether to allow items with the same name as the containing module.

Affected lints: module_name_repetitions

Default: true
allow-expect-in-consts boolean

Whether expect should be allowed within const blocks evaluated at compile time.

Affected lints: expect_used

Default: true
allow-expect-in-tests boolean

Whether expect should be allowed in test functions or #[cfg(test)] code.

Affected lints: expect_used

Default: false
allow-indexing-slicing-in-tests boolean

Whether indexing and slicing should be allowed in test functions or #[cfg(test)] code.

Affected lints: indexing_slicing

Default: false
allow-mixed-uninlined-format-args boolean

Whether to allow mixed uninlined format args, e.g. format!("{} {x}", x.y).

Affected lints: uninlined_format_args

Default: true
allow-one-hash-in-raw-strings boolean

Whether to allow r#""# when r"" can be used.

Affected lints: needless_raw_string_hashes

Default: false
allow-panic-in-tests boolean

Whether panic should be allowed in test functions or #[cfg(test)] code.

Affected lints: panic

Default: false
allow-print-in-tests boolean

Whether print macros (e.g. println!) should be allowed in test functions or #[cfg(test)] code.

Affected lints: print_stderr, print_stdout

Default: false
allow-private-module-inception boolean

Whether to allow module inception if the module is not public.

Affected lints: module_inception

Default: false
allow-renamed-params-for string[]

List of trait paths for which renamed parameter names are allowed. Supports the ".." element to extend the default list.

Affected lints: renamed_function_params

Default:
[
  "core::convert::From",
  "core::convert::TryFrom",
  "core::str::FromStr"
]
allow-unwrap-in-consts boolean

Whether unwrap should be allowed within const blocks evaluated at compile time.

Affected lints: unwrap_used

Default: true
allow-unwrap-in-tests boolean

Whether unwrap should be allowed in test functions or #[cfg(test)] code.

Affected lints: unwrap_used

Default: false
allow-useless-vec-in-tests boolean

Whether useless_vec should be ignored in test functions or #[cfg(test)] code.

Affected lints: useless_vec

Default: false
allowed-dotfiles string[]

Additional dotfiles (files or directories starting with a dot) to allow.

Affected lints: path_ends_with_ext

Default:
[]
allowed-duplicate-crates string[]

A list of crate names that are allowed to have multiple versions in the dependency tree.

Affected lints: multiple_crate_versions

Default:
[]
allowed-idents-below-min-chars string[]

Identifiers that are allowed to be shorter than min-ident-chars-threshold. Supports the ".." element to extend the default list.

Affected lints: min_ident_chars

Default:
[
  "i",
  "j",
  "x",
  "y",
  "z",
  "w",
  "n"
]
allowed-prefixes string[]

List of prefixes to allow when checking for module name repetitions. Supports the ".." element to extend the default list.

Affected lints: module_name_repetitions

Default:
[
  "to",
  "as",
  "into",
  "from",
  "try_into",
  "try_from"
]
allowed-scripts string[]

The list of Unicode scripts allowed in identifiers. Supports the ".." element to extend the default list.

Affected lints: disallowed_script_idents

Default:
[
  "Latin"
]
allowed-wildcard-imports string[]

List of path segments allowed to have wildcard imports (e.g. prelude).

Affected lints: wildcard_imports

Default:
[]
arithmetic-side-effects-allowed string[]

Types to allow arithmetic operations on without linting. Supports the ".." element to extend the default list.

Affected lints: arithmetic_side_effects

Default:
[]
arithmetic-side-effects-allowed-binary string[][]

Pairs of types [left, right] for which binary arithmetic operations are allowed. Use "*" as a wildcard to match any type.

Affected lints: arithmetic_side_effects

Default:
[]
arithmetic-side-effects-allowed-unary string[]

Types for which unary arithmetic operations (negation, !) are allowed.

Affected lints: arithmetic_side_effects

Default:
[]
array-size-threshold integer

The maximum allowed size (in bytes) for arrays on the stack.

Affected lints: large_const_arrays, large_stack_arrays

Default: 16384
min=0
await-holding-invalid-types string | DisallowedPath[]

Types that may not be held across .await points.

Affected lints: await_holding_invalid_type

Default:
[]
cargo-ignore-publish boolean

For internal testing only. Whether to ignore the publish field in Cargo.toml.

Affected lints: cargo_common_metadata

Default: false
check-incompatible-msrv-in-tests boolean

Whether to also check MSRV compatibility in test code.

Affected lints: incompatible_msrv

Default: false
check-inconsistent-struct-field-initializers boolean

Whether to suggest reordering constructor fields when some have shorthand initializers.

Affected lints: inconsistent_struct_constructor

Default: false
check-private-items boolean

Whether to also run the applicable lint on private items.

Affected lints: missing_errors_doc, missing_panics_doc, missing_safety_doc, unnecessary_safety_doc

Default: false
cognitive-complexity-threshold integer

The maximum cognitive complexity a function can have.

Affected lints: cognitive_complexity

Default: 25
min=0
const-literal-digits-threshold integer

Minimum number of digits in a float literal in a const context before linting.

Affected lints: excessive_precision

Default: 30
min=0
disallowed-macros string | DisallowedItem[]

List of macros that are not allowed to be used. Each entry can be a path string or an object with additional metadata.

Affected lints: disallowed_macros

Default:
[]
disallowed-methods string | DisallowedItem[]

List of methods that are not allowed to be used. Each entry can be a path string or an object with additional metadata.

Affected lints: disallowed_methods

Default:
[]
disallowed-names string[]

List of disallowed variable names (e.g. placeholder names). Supports the ".." element to extend the default list.

Affected lints: disallowed_names

Default:
[
  "foo",
  "baz",
  "quux"
]
disallowed-types string | DisallowedItem[]

List of types that are not allowed to be used. Each entry can be a path string or an object with additional metadata.

Affected lints: disallowed_types

Default:
[]
doc-valid-idents string[]

List of identifiers that are valid in documentation without backtick quoting. Supports the ".." element to extend the default list.

Affected lints: doc_markdown

Default:
[
  "KiB",
  "MiB",
  "GiB",
  "TiB",
  "PiB",
  "EiB",
  "MHz",
  "GHz",
  "THz",
  "AccessKit",
  "CoAP",
  "CoreFoundation",
  "CoreGraphics",
  "CoreText",
  "DevOps",
  "Direct2D",
  "Direct3D",
  "DirectWrite",
  "DirectX",
  "ECMAScript",
  "GPLv2",
  "GPLv3",
  "GitHub",
  "GitLab",
  "IPv4",
  "IPv6",
  "InfiniBand",
  "RoCE",
  "ClojureScript",
  "CoffeeScript",
  "JavaScript",
  "PostScript",
  "PureScript",
  "TypeScript",
  "PowerPC",
  "WebAssembly",
  "NaN",
  "NaNs",
  "OAuth",
  "GraphQL",
  "OCaml",
  "OpenAL",
  "OpenDNS",
  "OpenGL",
  "OpenMP",
  "OpenSSH",
  "OpenSSL",
  "OpenStreetMap",
  "OpenTelemetry",
  "OpenType",
  "WebGL",
  "WebGL2",
  "WebGPU",
  "WebRTC",
  "WebSocket",
  "WebTransport",
  "WebP",
  "OpenExr",
  "YCbCr",
  "sRGB",
  "TensorFlow",
  "TrueType",
  "iOS",
  "macOS",
  "FreeBSD",
  "NetBSD",
  "OpenBSD",
  "NixOS",
  "TeX",
  "LaTeX",
  "BibTeX",
  "BibLaTeX",
  "MinGW",
  "CamelCase"
]
enable-raw-pointer-heuristic-for-send boolean

Whether to apply the raw pointer heuristic to determine if a type is Send.

Affected lints: non_send_fields_in_send_ty

Default: true
enforce-iter-loop-reborrow boolean

Whether to recommend using implicit into_iter() for reborrowed values in for loops.

Affected lints: explicit_iter_loop

Default: false
enforced-import-renames ImportRename[]

List of imports that must always be renamed. Each entry specifies a path and its required rename.

Affected lints: missing_enforced_import_renames

Default:
[]
enum-variant-name-threshold integer

The minimum number of enum variants for the enum variant name lints to trigger.

Affected lints: enum_variant_names

Default: 3
min=0
enum-variant-size-threshold integer

The maximum size (in bytes) of an enum variant before suggesting boxing.

Affected lints: large_enum_variant

Default: 200
min=0
excessive-nesting-threshold integer

The maximum block nesting depth allowed before linting.

Affected lints: excessive_nesting

Default: 0
min=0
future-size-threshold integer

The maximum byte size of a Future before linting.

Affected lints: large_futures

Default: 16384
min=0
ignore-interior-mutability string[]

Types to treat as if they have no interior mutability. Supports the ".." element to extend the default list.

Affected lints: borrow_interior_mutable_const, declare_interior_mutable_const, ifs_same_cond, mutable_key_type

Default:
[
  "bytes::Bytes"
]
inherent-impl-lint-scope string

The scope for checking duplicate inherent implementations.

Affected lints: multiple_inherent_impl

Default: "crate"
Values: "crate" "file" "module"
large-error-ignored string[]

Error types to ignore for the result_large_err lint.

Affected lints: result_large_err

Default:
[]
large-error-threshold integer

The maximum size (in bytes) of the Err variant in a Result type.

Affected lints: result_large_err

Default: 128
min=0
lint-commented-code boolean

Whether to lint collapsible if/else chains that contain comments between them.

Affected lints: collapsible_else_if, collapsible_if

Default: false
literal-representation-threshold integer

The lower bound for linting decimal literals that are not human-readable.

Affected lints: decimal_literal_representation

Default: 16384
min=0
matches-for-let-else string

Which kind of match arms to consider when linting manual_let_else.

Affected lints: manual_let_else

Default: "WellKnownTypes"
Values: "WellKnownTypes" "Simple" "All"
max-fn-params-bools integer

The maximum number of boolean parameters a function can have.

Affected lints: fn_params_excessive_bools

Default: 3
min=0
max-include-file-size integer

The maximum size (in bytes) of a file included via include_bytes! or include_str!.

Affected lints: large_include_file

Default: 1000000
min=0
max-struct-bools integer

The maximum number of boolean fields a struct can have.

Affected lints: struct_excessive_bools

Default: 3
min=0
max-suggested-slice-pattern-length integer

The maximum number of elements in a suggested slice pattern.

Affected lints: index_refutable_slice

Default: 3
min=0
max-trait-bounds integer

The maximum number of trait bounds before suggesting a trait alias.

Affected lints: type_repetition_in_bounds

Default: 3
min=0
min-ident-chars-threshold integer

Minimum number of characters an identifier must have. Identifiers shorter than this are linted.

Affected lints: min_ident_chars

Default: 1
min=0
missing-docs-allow-unused boolean

Whether to allow underscore-prefixed fields to skip documentation.

Affected lints: missing_docs_in_private_items

Default: false
missing-docs-in-crate-items boolean

Whether to only check items visible within the current crate for missing documentation.

Affected lints: missing_docs_in_private_items

Default: false
module-item-order-groupings ModuleItemOrderGrouping[]

Named groupings of source item kinds for the arbitrary_source_item_ordering lint. Each entry defines a group name and the item kinds it contains.

Affected lints: arbitrary_source_item_ordering

Default:
[
  {
    "name": "modules",
    "items": [
      "extern_crate",
      "mod",
      "foreign_mod"
    ]
  },
  {
    "name": "use",
    "items": [
      "use"
    ]
  },
  {
    "name": "macros",
    "items": [
      "macro"
    ]
  },
  {
    "name": "global_asm",
    "items": [
      "global_asm"
    ]
  },
  {
    "name": "UPPER_SNAKE_CASE",
    "items": [
      "static",
      "const"
    ]
  },
  {
    "name": "PascalCase",
    "items": [
      "ty_alias",
      "enum",
      "struct",
      "union",
      "trait",
      "trait_alias",
      "impl"
    ]
  },
  {
    "name": "lower_snake_case",
    "items": [
      "fn"
    ]
  }
]
module-items-ordered-within-groupings string

Whether items within groupings must be ordered alphabetically. Can be "none", "all", or a specific grouping name.

Affected lints: arbitrary_source_item_ordering

Default: "none"
msrv string

The minimum supported Rust version. Clippy will take this into account when suggesting alternatives that require a newer version. Use a version string like "1.70.0". You can also omit the patch version: "1.70" equals "1.70.0".

Affected lints: allow_attributes, allow_attributes_without_reason, almost_complete_range, approx_constant, assigning_clones, borrow_as_ptr, cast_abs_to_unsigned, checked_conversions, cloned_instead_of_copied, collapsible_match, collapsible_str_replace, deprecated_cfg_attr, derivable_impls, err_expect, filter_map_next, from_over_into, if_then_some_else_none, index_refutable_slice, inefficient_to_string, io_other_error, iter_kv_map, legacy_numeric_constants, len_zero, lines_filter_map_ok, manual_abs_diff, manual_bits, manual_c_str_literals, manual_clamp, manual_div_ceil, manual_flatten, manual_hash_one, manual_is_ascii_check, manual_is_power_of_two, manual_let_else, manual_midpoint, manual_non_exhaustive, manual_option_as_slice, manual_pattern_char_comparison, manual_range_contains, manual_rem_euclid, manual_repeat_n, manual_retain, manual_slice_fill, manual_slice_size_calculation, manual_split_once, manual_str_repeat, manual_strip, manual_try_fold, map_clone, map_unwrap_or, map_with_unused_argument_over_ranges, match_like_matches_macro, mem_replace_option_with_some, mem_replace_with_default, missing_const_for_fn, needless_borrow, non_std_lazy_statics, option_as_ref_deref, or_fun_call, ptr_as_ptr, question_mark, redundant_field_names, redundant_static_lifetimes, repeat_vec_with_capacity, same_item_push, seek_from_current, to_digit_is_some, transmute_ptr_to_ref, tuple_array_conversions, type_repetition_in_bounds, unchecked_time_subtraction, uninlined_format_args, unnecessary_lazy_evaluations, unnecessary_unwrap, unnested_or_patterns, unused_trait_names, use_self, zero_ptr

pattern=^\d+\.\d+(\.\d+)?$
pass-by-value-size-limit integer

Minimum size (in bytes) for a type to be passed by reference instead of by value.

Affected lints: large_types_passed_by_value

Default: 256
min=0
pub-underscore-fields-behavior string

Lint behavior for pub fields with underscore-prefixed names.

Affected lints: pub_underscore_fields

Default: "PubliclyExported"
Values: "PubliclyExported" "AllPubFields"
recursive-self-in-type-definitions boolean

Whether to suggest replacing recursive type references with Self.

Affected lints: use_self

Default: true
semicolon-inside-block-ignore-singleline boolean

Whether to only lint multiline blocks for semicolons inside blocks.

Affected lints: semicolon_inside_block

Default: false
semicolon-outside-block-ignore-multiline boolean

Whether to only lint single-line blocks for semicolons outside blocks.

Affected lints: semicolon_outside_block

Default: false
single-char-binding-names-threshold integer

The maximum number of single-character bindings a scope can have.

Affected lints: many_single_char_names

Default: 4
min=0
source-item-ordering string[]

Which source item kinds to check for ordering within modules.

Affected lints: arbitrary_source_item_ordering

Default:
[
  "enum",
  "impl",
  "module",
  "struct",
  "trait"
]
stack-size-threshold integer

The maximum stack size (in bytes) a function is allowed to use.

Affected lints: large_stack_frames

Default: 512000
min=0
standard-macro-braces MacroBrace[]

Enforce specific brace styles for macro invocations. Each entry specifies a macro name and the brace character to enforce.

Affected lints: nonstandard_macro_braces

Default:
[]
struct-field-name-threshold integer

The minimum number of struct fields for the struct field name lints to trigger.

Affected lints: struct_field_names

Default: 3
min=0
suppress-restriction-lint-in-const boolean

Whether to suppress restriction lints in constant code.

Affected lints: indexing_slicing

Default: false
too-large-for-stack integer

The maximum object size (in bytes) on the stack before suggesting boxing.

Affected lints: boxed_local, useless_vec

Default: 200
min=0
too-many-arguments-threshold integer

The maximum number of parameters a function can have.

Affected lints: too_many_arguments

Default: 7
min=0
too-many-lines-threshold integer

The maximum number of lines a function body can have.

Affected lints: too_many_lines

Default: 100
min=0
trait-assoc-item-kinds-order string[]

The preferred ordering of associated items in a trait definition.

Affected lints: arbitrary_source_item_ordering

Default:
[
  "const",
  "type",
  "fn"
]
trivial-copy-size-limit integer

The maximum size (in bytes) of a Copy type that can be passed by value. Defaults to target_pointer_width * 2 when unset.

Affected lints: trivially_copy_pass_by_ref

min=0
type-complexity-threshold integer

The maximum complexity score a type can have before being linted.

Affected lints: type_complexity

Default: 250
min=0
unnecessary-box-size integer

The byte size below which Box<T> is unnecessary and the value should be unboxed.

Affected lints: unnecessary_box_returns

Default: 128
min=0
unreadable-literal-lint-fractions boolean

Whether to lint the decimal fraction part of float literals for readability.

Affected lints: unreadable_literal

Default: true
upper-case-acronyms-aggressive boolean

Whether to enable verbose/aggressive mode for upper-case acronym checking.

Affected lints: upper_case_acronyms

Default: false
vec-box-size-threshold integer

The maximum size (in bytes) of a boxed type in a Vec before suggesting Vec<T> instead.

Affected lints: vec_box

Default: 4096
min=0
verbose-bit-mask-threshold integer

The maximum bit mask size before suggesting .trailing_zeros().

Affected lints: verbose_bit_mask

Default: 1
min=0
warn-on-all-wildcard-imports boolean

Whether to warn on all wildcard imports, including those from prelude modules.

Affected lints: wildcard_imports

Default: false
warn-unsafe-macro-metavars-in-private-macros boolean

Whether to warn about unsafe metavariable expansions in private macro_rules! macros.

Affected lints: macro_metavars_in_unsafe

Default: false

Definitions

DisallowedItem object

A disallowed item (macro, method, or type) with optional reason and replacement.

path string required

Fully qualified path of the disallowed item (e.g. std::vec::Vec::leak).

reason string

Explanation for why this item is disallowed. Shown in the lint message.

replacement string

Suggested replacement to use instead. Shown in the lint message.

allow-invalid boolean

If true, suppress the warning when the path cannot be resolved. Useful for conditionally compiled code.

Default: false
DisallowedPath object

A disallowed type path with optional reason.

path string required

Fully qualified type path.

reason string

Explanation for why this type is disallowed.

ImportRename object

An import that must be renamed when used.

path string required

Fully qualified path of the import (e.g. std::process::exit).

rename string required

The required rename for this import.

MacroBrace object

Enforced brace style for a specific macro.

name string required

Macro name, either simple (e.g. vec) or fully qualified (e.g. std::vec).

brace string required

The brace character to enforce for this macro.

Values: "(" "{" "["
ModuleItemOrderGrouping object

A named grouping of source item kinds for ordering within modules.

name string required

Display name for this grouping (e.g. "modules", "PascalCase").

items string[] required

List of source item kinds in this group.