pub struct Conf {Show 93 fields
pub absolute_paths_allowed_crates: Vec<String>,
pub absolute_paths_max_segments: u64,
pub accept_comment_above_attributes: bool,
pub accept_comment_above_statement: bool,
pub allow_comparison_to_zero: bool,
pub allow_dbg_in_tests: bool,
pub allow_exact_repetitions: bool,
pub allow_expect_in_consts: bool,
pub allow_expect_in_tests: bool,
pub allow_indexing_slicing_in_tests: bool,
pub allow_mixed_uninlined_format_args: bool,
pub allow_one_hash_in_raw_strings: bool,
pub allow_panic_in_tests: bool,
pub allow_print_in_tests: bool,
pub allow_private_module_inception: bool,
pub allow_renamed_params_for: Vec<String>,
pub allow_unwrap_in_consts: bool,
pub allow_unwrap_in_tests: bool,
pub allow_useless_vec_in_tests: bool,
pub allowed_dotfiles: Vec<String>,
pub allowed_duplicate_crates: Vec<String>,
pub allowed_idents_below_min_chars: Vec<String>,
pub allowed_prefixes: Vec<String>,
pub allowed_scripts: Vec<String>,
pub allowed_wildcard_imports: Vec<String>,
pub arithmetic_side_effects_allowed: Vec<String>,
pub arithmetic_side_effects_allowed_binary: Vec<(String, String)>,
pub arithmetic_side_effects_allowed_unary: Vec<String>,
pub array_size_threshold: u64,
pub avoid_breaking_exported_api: bool,
pub await_holding_invalid_types: Vec<DisallowedPathWithoutReplacement>,
pub blacklisted_names: Vec<String>,
pub cargo_ignore_publish: bool,
pub check_incompatible_msrv_in_tests: bool,
pub check_inconsistent_struct_field_initializers: bool,
pub check_private_items: bool,
pub cognitive_complexity_threshold: u64,
pub const_literal_digits_threshold: usize,
pub cyclomatic_complexity_threshold: u64,
pub disallowed_macros: Vec<DisallowedPath>,
pub disallowed_methods: Vec<DisallowedPath>,
pub disallowed_names: Vec<String>,
pub disallowed_types: Vec<DisallowedPath>,
pub doc_valid_idents: Vec<String>,
pub enable_raw_pointer_heuristic_for_send: bool,
pub enforce_iter_loop_reborrow: bool,
pub enforced_import_renames: Vec<Rename>,
pub enum_variant_name_threshold: u64,
pub enum_variant_size_threshold: u64,
pub excessive_nesting_threshold: u64,
pub future_size_threshold: u64,
pub ignore_interior_mutability: Vec<String>,
pub inherent_impl_lint_scope: InherentImplLintScope,
pub large_error_threshold: u64,
pub lint_commented_code: bool,
pub lint_inconsistent_struct_field_initializers: bool,
pub literal_representation_threshold: u64,
pub matches_for_let_else: MatchLintBehaviour,
pub max_fn_params_bools: u64,
pub max_include_file_size: u64,
pub max_struct_bools: u64,
pub max_suggested_slice_pattern_length: u64,
pub max_trait_bounds: u64,
pub min_ident_chars_threshold: u64,
pub missing_docs_allow_unused: bool,
pub missing_docs_in_crate_items: bool,
pub module_item_order_groupings: SourceItemOrderingModuleItemGroupings,
pub module_items_ordered_within_groupings: SourceItemOrderingWithinModuleItemGroupings,
pub msrv: Msrv,
pub pass_by_value_size_limit: u64,
pub pub_underscore_fields_behavior: PubUnderscoreFieldsBehaviour,
pub recursive_self_in_type_definitions: bool,
pub semicolon_inside_block_ignore_singleline: bool,
pub semicolon_outside_block_ignore_multiline: bool,
pub single_char_binding_names_threshold: u64,
pub source_item_ordering: SourceItemOrdering,
pub stack_size_threshold: u64,
pub standard_macro_braces: Vec<MacroMatcher>,
pub struct_field_name_threshold: u64,
pub suppress_restriction_lint_in_const: bool,
pub too_large_for_stack: u64,
pub too_many_arguments_threshold: u64,
pub too_many_lines_threshold: u64,
pub trait_assoc_item_kinds_order: SourceItemOrderingTraitAssocItemKinds,
pub trivial_copy_size_limit: Option<u64>,
pub type_complexity_threshold: u64,
pub unnecessary_box_size: u64,
pub unreadable_literal_lint_fractions: bool,
pub upper_case_acronyms_aggressive: bool,
pub vec_box_size_threshold: u64,
pub verbose_bit_mask_threshold: u64,
pub warn_on_all_wildcard_imports: bool,
pub warn_unsafe_macro_metavars_in_private_macros: bool,
}Expand description
Clippy lint configuration
Fields§
§absolute_paths_allowed_crates: Vec<String>Which crates to allow absolute paths from
absolute_paths_max_segments: u64The maximum number of segments a path can have before being linted, anything above this will be linted.
accept_comment_above_attributes: boolWhether to accept a safety comment to be placed above the attributes for the unsafe block
accept_comment_above_statement: boolWhether to accept a safety comment to be placed above the statement containing the unsafe block
allow_comparison_to_zero: boolDon’t lint when comparing the result of a modulo operation to zero.
allow_dbg_in_tests: boolWhether dbg! should be allowed in test functions or #[cfg(test)]
allow_exact_repetitions: boolWhether an item should be allowed to have the same name as its containing module
allow_expect_in_consts: boolWhether expect should be allowed in code always evaluated at compile time
allow_expect_in_tests: boolWhether expect should be allowed in test functions or #[cfg(test)]
allow_indexing_slicing_in_tests: boolWhether indexing_slicing should be allowed in test functions or #[cfg(test)]
allow_mixed_uninlined_format_args: boolWhether to allow mixed uninlined format args, e.g. format!("{} {}", a, foo.bar)
allow_one_hash_in_raw_strings: boolWhether to allow r#""# when r"" can be used
allow_panic_in_tests: boolWhether panic should be allowed in test functions or #[cfg(test)]
allow_print_in_tests: boolWhether print macros (ex. println!) should be allowed in test functions or #[cfg(test)]
allow_private_module_inception: boolWhether to allow module inception if it’s not public.
allow_renamed_params_for: Vec<String>List of trait paths to ignore when checking renamed function parameters.
§Example
allow-renamed-params-for = [ "std::convert::From" ]§Noteworthy
- By default, the following traits are ignored:
From,TryFrom,FromStr ".."can be used as part of the list to indicate that the configured values should be appended to the default configuration of Clippy. By default, any configuration will replace the default value.
allow_unwrap_in_consts: boolWhether unwrap should be allowed in code always evaluated at compile time
allow_unwrap_in_tests: boolWhether unwrap should be allowed in test functions or #[cfg(test)]
allow_useless_vec_in_tests: boolWhether useless_vec should ignore test functions or #[cfg(test)]
allowed_dotfiles: Vec<String>Additional dotfiles (files or directories starting with a dot) to allow
allowed_duplicate_crates: Vec<String>A list of crate names to allow duplicates of
allowed_idents_below_min_chars: Vec<String>Allowed names below the minimum allowed characters. The value ".." can be used as part of
the list to indicate, that the configured values should be appended to the default
configuration of Clippy. By default, any configuration will replace the default value.
allowed_prefixes: Vec<String>List of prefixes to allow when determining whether an item’s name ends with the module’s name.
If the rest of an item’s name is an allowed prefix (e.g. item ToFoo or to_foo in module foo),
then don’t emit a warning.
§Example
allowed-prefixes = [ "to", "from" ]§Noteworthy
- By default, the following prefixes are allowed:
to,as,into,from,try_intoandtry_from - PascalCase variant is included automatically for each snake_case variant (e.g. if
try_intois included,TryIntowill also be included) - Use
".."as part of the list to indicate that the configured values should be appended to the default configuration of Clippy. By default, any configuration will replace the default value
allowed_scripts: Vec<String>The list of unicode scripts allowed to be used in the scope.
allowed_wildcard_imports: Vec<String>List of path segments allowed to have wildcard imports.
§Example
allowed-wildcard-imports = [ "utils", "common" ]§Noteworthy
- This configuration has no effects if used with
warn_on_all_wildcard_imports = true. - Paths with any segment that containing the word ‘prelude’ are already allowed by default.
arithmetic_side_effects_allowed: Vec<String>Suppress checking of the passed type names in all types of operations.
If a specific operation is desired, consider using arithmetic_side_effects_allowed_binary or arithmetic_side_effects_allowed_unary instead.
§Example
arithmetic-side-effects-allowed = ["SomeType", "AnotherType"]§Noteworthy
A type, say SomeType, listed in this configuration has the same behavior of
["SomeType" , "*"], ["*", "SomeType"] in arithmetic_side_effects_allowed_binary.
arithmetic_side_effects_allowed_binary: Vec<(String, String)>Suppress checking of the passed type pair names in binary operations like addition or multiplication.
Supports the “*” wildcard to indicate that a certain type won’t trigger the lint regardless
of the involved counterpart. For example, ["SomeType", "*"] or ["*", "AnotherType"].
Pairs are asymmetric, which means that ["SomeType", "AnotherType"] is not the same as
["AnotherType", "SomeType"].
§Example
arithmetic-side-effects-allowed-binary = [["SomeType" , "f32"], ["AnotherType", "*"]]arithmetic_side_effects_allowed_unary: Vec<String>Suppress checking of the passed type names in unary operations like “negation” (-).
§Example
arithmetic-side-effects-allowed-unary = ["SomeType", "AnotherType"]array_size_threshold: u64The maximum allowed size for arrays on the stack
avoid_breaking_exported_api: boolSuppress lints whenever the suggested change would cause breakage for other crates.
await_holding_invalid_types: Vec<DisallowedPathWithoutReplacement>The list of types which may not be held across an await point.
blacklisted_names: Vec<String>DEPRECATED LINT: BLACKLISTED_NAME.
Use the Disallowed Names lint instead
cargo_ignore_publish: boolFor internal testing only, ignores the current publish settings in the Cargo manifest.
check_incompatible_msrv_in_tests: boolWhether to check MSRV compatibility in #[test] and #[cfg(test)] code.
check_inconsistent_struct_field_initializers: boolWhether to suggest reordering constructor fields when initializers are present.
Warnings produced by this configuration aren’t necessarily fixed by just reordering the fields. Even if the suggested code would compile, it can change semantics if the initializer expressions have side effects. The following example from rust-clippy#11846 shows how the suggestion can run into borrow check errors:
struct MyStruct {
vector: Vec<u32>,
length: usize
}
fn main() {
let vector = vec![1,2,3];
MyStruct { length: vector.len(), vector};
}check_private_items: boolWhether to also run the listed lints on private items.
cognitive_complexity_threshold: u64The maximum cognitive complexity a function can have
const_literal_digits_threshold: usizeThe minimum digits a const float literal must have to supress the excessive_precicion lint
cyclomatic_complexity_threshold: u64DEPRECATED LINT: CYCLOMATIC_COMPLEXITY.
Use the Cognitive Complexity lint instead.
disallowed_macros: Vec<DisallowedPath>The list of disallowed macros, written as fully qualified paths.
Fields:
path(required): the fully qualified path to the macro that should be disallowedreason(optional): explanation why this macro is disallowedreplacement(optional): suggested alternative macroallow-invalid(optional,falseby default): when set totrue, it will ignore this entry if the path doesn’t exist, instead of emitting an error
disallowed_methods: Vec<DisallowedPath>The list of disallowed methods, written as fully qualified paths.
Fields:
path(required): the fully qualified path to the method that should be disallowedreason(optional): explanation why this method is disallowedreplacement(optional): suggested alternative methodallow-invalid(optional,falseby default): when set totrue, it will ignore this entry if the path doesn’t exist, instead of emitting an error
disallowed_names: Vec<String>The list of disallowed names to lint about. NB: bar is not here since it has legitimate uses. The value
".." can be used as part of the list to indicate that the configured values should be appended to the
default configuration of Clippy. By default, any configuration will replace the default value.
disallowed_types: Vec<DisallowedPath>The list of disallowed types, written as fully qualified paths.
Fields:
path(required): the fully qualified path to the type that should be disallowedreason(optional): explanation why this type is disallowedreplacement(optional): suggested alternative typeallow-invalid(optional,falseby default): when set totrue, it will ignore this entry if the path doesn’t exist, instead of emitting an error
doc_valid_idents: Vec<String>The list of words this lint should not consider as identifiers needing ticks. The value
".." can be used as part of the list to indicate, that the configured values should be appended to the
default configuration of Clippy. By default, any configuration will replace the default value. For example:
doc-valid-idents = ["ClipPy"]would replace the default list with["ClipPy"].doc-valid-idents = ["ClipPy", ".."]would appendClipPyto the default list.
enable_raw_pointer_heuristic_for_send: boolWhether to apply the raw pointer heuristic to determine if a type is Send.
enforce_iter_loop_reborrow: boolWhether to recommend using implicit into iter for reborrowed values.
§Example
let mut vec = vec![1, 2, 3];
let rmvec = &mut vec;
for _ in rmvec.iter() {}
for _ in rmvec.iter_mut() {}Use instead:
let mut vec = vec![1, 2, 3];
let rmvec = &mut vec;
for _ in &*rmvec {}
for _ in &mut *rmvec {}enforced_import_renames: Vec<Rename>The list of imports to always rename, a fully qualified path followed by the rename.
enum_variant_name_threshold: u64The minimum number of enum variants for the lints about variant names to trigger
enum_variant_size_threshold: u64The maximum size of an enum’s variant to avoid box suggestion
excessive_nesting_threshold: u64The maximum amount of nesting a block can reside in
future_size_threshold: u64The maximum byte size a Future can have, before it triggers the clippy::large_futures lint
ignore_interior_mutability: Vec<String>A list of paths to types that should be treated as if they do not contain interior mutability
inherent_impl_lint_scope: InherentImplLintScopeSets the scope (“crate”, “file”, or “module”) in which duplicate inherent impl blocks for the same type are linted.
large_error_threshold: u64The maximum size of the Err-variant in a Result returned from a function
lint_commented_code: boolWhether collapsible if and else if chains are linted if they contain comments inside the parts
that would be collapsed.
lint_inconsistent_struct_field_initializers: boolWhether to suggest reordering constructor fields when initializers are present. DEPRECATED CONFIGURATION: lint-inconsistent-struct-field-initializers
Use the check-inconsistent-struct-field-initializers configuration instead.
literal_representation_threshold: u64The lower bound for linting decimal literals
matches_for_let_else: MatchLintBehaviourWhether the matches should be considered by the lint, and whether there should be filtering for common types.
max_fn_params_bools: u64The maximum number of bool parameters a function can have
max_include_file_size: u64The maximum size of a file included via include_bytes!() or include_str!(), in bytes
max_struct_bools: u64The maximum number of bool fields a struct can have
max_suggested_slice_pattern_length: u64When Clippy suggests using a slice pattern, this is the maximum number of elements allowed in
the slice pattern that is suggested. If more elements are necessary, the lint is suppressed.
For example, [_, _, _, e, ..] is a slice pattern with 4 elements.
max_trait_bounds: u64The maximum number of bounds a trait can have to be linted
min_ident_chars_threshold: u64Minimum chars an ident can have, anything below or equal to this will be linted.
missing_docs_allow_unused: boolWhether to allow fields starting with an underscore to skip documentation requirements
missing_docs_in_crate_items: boolWhether to only check for missing documentation in items visible within the current
crate. For example, pub(crate) items.
module_item_order_groupings: SourceItemOrderingModuleItemGroupingsThe named groupings of different source item kinds within modules.
module_items_ordered_within_groupings: SourceItemOrderingWithinModuleItemGroupingsWhether the items within module groups should be ordered alphabetically or not.
This option can be configured to “all”, “none”, or a list of specific grouping names that should be checked (e.g. only “enums”).
msrv: MsrvThe minimum rust version that the project supports. Defaults to the rust-version field in Cargo.toml
pass_by_value_size_limit: u64The minimum size (in bytes) to consider a type for passing by reference instead of by value.
pub_underscore_fields_behavior: PubUnderscoreFieldsBehaviourLint “public” fields in a struct that are prefixed with an underscore based on their exported visibility, or whether they are marked as “pub”.
recursive_self_in_type_definitions: boolWhether the type itself in a struct or enum should be replaced with Self when encountering recursive types.
semicolon_inside_block_ignore_singleline: boolWhether to lint only if it’s multiline.
semicolon_outside_block_ignore_multiline: boolWhether to lint only if it’s singleline.
single_char_binding_names_threshold: u64The maximum number of single char bindings a scope may have
source_item_ordering: SourceItemOrderingWhich kind of elements should be ordered internally, possible values being enum, impl, module, struct, trait.
stack_size_threshold: u64The maximum allowed stack size for functions in bytes
standard_macro_braces: Vec<MacroMatcher>Enforce the named macros always use the braces specified.
A MacroMatcher can be added like so { name = "macro_name", brace = "(" }. If the macro
could be used with a full path two MacroMatchers have to be added one with the full path
crate_name::macro_name and one with just the macro name.
struct_field_name_threshold: u64The minimum number of struct fields for the lints about field names to trigger
suppress_restriction_lint_in_const: boolWhether to suppress a restriction lint in constant code. In same cases the restructured operation might not be unavoidable, as the suggested counterparts are unavailable in constant code. This configuration will cause restriction lints to trigger even if no suggestion can be made.
too_large_for_stack: u64The maximum size of objects (in bytes) that will be linted. Larger objects are ok on the heap
too_many_arguments_threshold: u64The maximum number of argument a function or method can have
too_many_lines_threshold: u64The maximum number of lines a function or method can have
trait_assoc_item_kinds_order: SourceItemOrderingTraitAssocItemKindsThe order of associated items in traits.
trivial_copy_size_limit: Option<u64>The maximum size (in bytes) to consider a Copy type for passing by value instead of by
reference.
type_complexity_threshold: u64The maximum complexity a type can have
unnecessary_box_size: u64The byte size a T in Box<T> can have, below which it triggers the clippy::unnecessary_box lint
unreadable_literal_lint_fractions: boolShould the fraction of a decimal be linted to include separators.
upper_case_acronyms_aggressive: boolEnables verbose mode. Triggers if there is more than one uppercase char next to each other
vec_box_size_threshold: u64The size of the boxed type in bytes, where boxing in a Vec is allowed
verbose_bit_mask_threshold: u64The maximum allowed size of a bit mask before suggesting to use ‘trailing_zeros’
warn_on_all_wildcard_imports: boolWhether to emit warnings on all wildcard imports, including those from prelude, from super in tests,
or for pub use reexports.
warn_unsafe_macro_metavars_in_private_macros: boolWhether to also emit warnings for unsafe blocks with metavariable expansions in private macros.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Conf
impl RefUnwindSafe for Conf
impl Send for Conf
impl Sync for Conf
impl Unpin for Conf
impl UnwindSafe for Conf
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreLayout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 984 bytes