Struct clippy_config::conf::Conf
source · pub struct Conf {Show 72 fields
pub arithmetic_side_effects_allowed: FxHashSet<String>,
pub arithmetic_side_effects_allowed_binary: Vec<[String; 2]>,
pub arithmetic_side_effects_allowed_unary: FxHashSet<String>,
pub avoid_breaking_exported_api: bool,
pub msrv: Msrv,
pub blacklisted_names: Vec<String>,
pub cognitive_complexity_threshold: u64,
pub excessive_nesting_threshold: u64,
pub cyclomatic_complexity_threshold: u64,
pub disallowed_names: Vec<String>,
pub semicolon_inside_block_ignore_singleline: bool,
pub semicolon_outside_block_ignore_multiline: bool,
pub doc_valid_idents: Vec<String>,
pub too_many_arguments_threshold: u64,
pub type_complexity_threshold: u64,
pub single_char_binding_names_threshold: u64,
pub too_large_for_stack: u64,
pub enum_variant_name_threshold: u64,
pub struct_field_name_threshold: u64,
pub enum_variant_size_threshold: u64,
pub verbose_bit_mask_threshold: u64,
pub literal_representation_threshold: u64,
pub trivial_copy_size_limit: Option<u64>,
pub pass_by_value_size_limit: u64,
pub too_many_lines_threshold: u64,
pub array_size_threshold: u64,
pub stack_size_threshold: u64,
pub vec_box_size_threshold: u64,
pub max_trait_bounds: u64,
pub max_struct_bools: u64,
pub max_fn_params_bools: u64,
pub warn_on_all_wildcard_imports: bool,
pub disallowed_macros: Vec<DisallowedPath>,
pub disallowed_methods: Vec<DisallowedPath>,
pub disallowed_types: Vec<DisallowedPath>,
pub unreadable_literal_lint_fractions: bool,
pub upper_case_acronyms_aggressive: bool,
pub matches_for_let_else: MatchLintBehaviour,
pub cargo_ignore_publish: bool,
pub standard_macro_braces: Vec<MacroMatcher>,
pub enforced_import_renames: Vec<Rename>,
pub allowed_scripts: Vec<String>,
pub enable_raw_pointer_heuristic_for_send: bool,
pub max_suggested_slice_pattern_length: u64,
pub await_holding_invalid_types: Vec<DisallowedPath>,
pub max_include_file_size: u64,
pub allow_expect_in_tests: bool,
pub allow_unwrap_in_tests: bool,
pub allow_dbg_in_tests: bool,
pub allow_print_in_tests: bool,
pub large_error_threshold: u64,
pub ignore_interior_mutability: Vec<String>,
pub allow_mixed_uninlined_format_args: bool,
pub suppress_restriction_lint_in_const: bool,
pub missing_docs_in_crate_items: bool,
pub future_size_threshold: u64,
pub unnecessary_box_size: u64,
pub allow_private_module_inception: bool,
pub allowed_idents_below_min_chars: FxHashSet<String>,
pub min_ident_chars_threshold: u64,
pub accept_comment_above_statement: bool,
pub accept_comment_above_attributes: bool,
pub allow_one_hash_in_raw_strings: bool,
pub absolute_paths_max_segments: u64,
pub absolute_paths_allowed_crates: FxHashSet<String>,
pub allowed_dotfiles: FxHashSet<String>,
pub allowed_duplicate_crates: FxHashSet<String>,
pub enforce_iter_loop_reborrow: bool,
pub check_private_items: bool,
pub pub_underscore_fields_behavior: PubUnderscoreFieldsBehaviour,
pub allow_comparison_to_zero: bool,
pub allowed_wildcard_imports: FxHashSet<String>,
}
Expand description
Clippy lint configuration
Fields§
§arithmetic_side_effects_allowed: FxHashSet<String>
Lint: ARITHMETIC_SIDE_EFFECTS.
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; 2]>
Lint: ARITHMETIC_SIDE_EFFECTS.
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: FxHashSet<String>
Lint: ARITHMETIC_SIDE_EFFECTS.
Suppress checking of the passed type names in unary operations like “negation” (-
).
§Example
arithmetic-side-effects-allowed-unary = ["SomeType", "AnotherType"]
avoid_breaking_exported_api: bool
Lint: ENUM_VARIANT_NAMES, LARGE_TYPES_PASSED_BY_VALUE, TRIVIALLY_COPY_PASS_BY_REF, UNNECESSARY_WRAPS, UNUSED_SELF, UPPER_CASE_ACRONYMS, WRONG_SELF_CONVENTION, BOX_COLLECTION, REDUNDANT_ALLOCATION, RC_BUFFER, VEC_BOX, OPTION_OPTION, LINKEDLIST, RC_MUTEX, UNNECESSARY_BOX_RETURNS, SINGLE_CALL_FN.
Suppress lints whenever the suggested change would cause breakage for other crates.
msrv: Msrv
Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP, MANUAL_C_STR_LITERALS, ASSIGNING_CLONES, LEGACY_NUMERIC_CONSTANTS.
The minimum rust version that the project supports. Defaults to the rust-version
field in Cargo.toml
blacklisted_names: Vec<String>
DEPRECATED LINT: BLACKLISTED_NAME.
Use the Disallowed Names lint instead
cognitive_complexity_threshold: u64
Lint: COGNITIVE_COMPLEXITY.
The maximum cognitive complexity a function can have
excessive_nesting_threshold: u64
Lint: EXCESSIVE_NESTING.
The maximum amount of nesting a block can reside in
cyclomatic_complexity_threshold: u64
DEPRECATED LINT: CYCLOMATIC_COMPLEXITY.
Use the Cognitive Complexity lint instead.
disallowed_names: Vec<String>
Lint: DISALLOWED_NAMES.
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.
semicolon_inside_block_ignore_singleline: bool
Lint: SEMICOLON_INSIDE_BLOCK.
Whether to lint only if it’s multiline.
semicolon_outside_block_ignore_multiline: bool
Lint: SEMICOLON_OUTSIDE_BLOCK.
Whether to lint only if it’s singleline.
doc_valid_idents: Vec<String>
Lint: DOC_MARKDOWN.
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 appendClipPy
to the default list.
too_many_arguments_threshold: u64
Lint: TOO_MANY_ARGUMENTS.
The maximum number of argument a function or method can have
type_complexity_threshold: u64
Lint: TYPE_COMPLEXITY.
The maximum complexity a type can have
single_char_binding_names_threshold: u64
Lint: MANY_SINGLE_CHAR_NAMES.
The maximum number of single char bindings a scope may have
too_large_for_stack: u64
Lint: BOXED_LOCAL, USELESS_VEC.
The maximum size of objects (in bytes) that will be linted. Larger objects are ok on the heap
enum_variant_name_threshold: u64
Lint: ENUM_VARIANT_NAMES.
The minimum number of enum variants for the lints about variant names to trigger
struct_field_name_threshold: u64
Lint: STRUCT_FIELD_NAMES.
The minimum number of struct fields for the lints about field names to trigger
enum_variant_size_threshold: u64
Lint: LARGE_ENUM_VARIANT.
The maximum size of an enum’s variant to avoid box suggestion
verbose_bit_mask_threshold: u64
Lint: VERBOSE_BIT_MASK.
The maximum allowed size of a bit mask before suggesting to use ‘trailing_zeros’
literal_representation_threshold: u64
Lint: DECIMAL_LITERAL_REPRESENTATION.
The lower bound for linting decimal literals
trivial_copy_size_limit: Option<u64>
Lint: TRIVIALLY_COPY_PASS_BY_REF.
The maximum size (in bytes) to consider a Copy
type for passing by value instead of by
reference. By default there is no limit
pass_by_value_size_limit: u64
Lint: LARGE_TYPES_PASSED_BY_VALUE.
The minimum size (in bytes) to consider a type for passing by reference instead of by value.
too_many_lines_threshold: u64
Lint: TOO_MANY_LINES.
The maximum number of lines a function or method can have
array_size_threshold: u64
Lint: LARGE_STACK_ARRAYS, LARGE_CONST_ARRAYS.
The maximum allowed size for arrays on the stack
stack_size_threshold: u64
Lint: LARGE_STACK_FRAMES.
The maximum allowed stack size for functions in bytes
vec_box_size_threshold: u64
Lint: VEC_BOX.
The size of the boxed type in bytes, where boxing in a Vec
is allowed
max_trait_bounds: u64
Lint: TYPE_REPETITION_IN_BOUNDS.
The maximum number of bounds a trait can have to be linted
max_struct_bools: u64
Lint: STRUCT_EXCESSIVE_BOOLS.
The maximum number of bool fields a struct can have
max_fn_params_bools: u64
Lint: FN_PARAMS_EXCESSIVE_BOOLS.
The maximum number of bool parameters a function can have
warn_on_all_wildcard_imports: bool
Lint: WILDCARD_IMPORTS.
Whether to allow certain wildcard imports (prelude, super in tests).
disallowed_macros: Vec<DisallowedPath>
Lint: DISALLOWED_MACROS.
The list of disallowed macros, written as fully qualified paths.
disallowed_methods: Vec<DisallowedPath>
Lint: DISALLOWED_METHODS.
The list of disallowed methods, written as fully qualified paths.
disallowed_types: Vec<DisallowedPath>
Lint: DISALLOWED_TYPES.
The list of disallowed types, written as fully qualified paths.
unreadable_literal_lint_fractions: bool
Lint: UNREADABLE_LITERAL.
Should the fraction of a decimal be linted to include separators.
upper_case_acronyms_aggressive: bool
Lint: UPPER_CASE_ACRONYMS.
Enables verbose mode. Triggers if there is more than one uppercase char next to each other
matches_for_let_else: MatchLintBehaviour
Lint: MANUAL_LET_ELSE.
Whether the matches should be considered by the lint, and whether there should be filtering for common types.
cargo_ignore_publish: bool
Lint: CARGO_COMMON_METADATA.
For internal testing only, ignores the current publish
settings in the Cargo manifest.
standard_macro_braces: Vec<MacroMatcher>
Lint: NONSTANDARD_MACRO_BRACES.
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 MacroMatcher
s have to be added one with the full path
crate_name::macro_name
and one with just the macro name.
enforced_import_renames: Vec<Rename>
Lint: MISSING_ENFORCED_IMPORT_RENAMES.
The list of imports to always rename, a fully qualified path followed by the rename.
allowed_scripts: Vec<String>
Lint: DISALLOWED_SCRIPT_IDENTS.
The list of unicode scripts allowed to be used in the scope.
enable_raw_pointer_heuristic_for_send: bool
Lint: NON_SEND_FIELDS_IN_SEND_TY.
Whether to apply the raw pointer heuristic to determine if a type is Send
.
max_suggested_slice_pattern_length: u64
Lint: INDEX_REFUTABLE_SLICE.
When 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.
await_holding_invalid_types: Vec<DisallowedPath>
Lint: AWAIT_HOLDING_INVALID_TYPE.
max_include_file_size: u64
Lint: LARGE_INCLUDE_FILE.
The maximum size of a file included via include_bytes!()
or include_str!()
, in bytes
allow_expect_in_tests: bool
Lint: EXPECT_USED.
Whether expect
should be allowed in test functions or #[cfg(test)]
allow_unwrap_in_tests: bool
Lint: UNWRAP_USED.
Whether unwrap
should be allowed in test functions or #[cfg(test)]
allow_dbg_in_tests: bool
Lint: DBG_MACRO.
Whether dbg!
should be allowed in test functions or #[cfg(test)]
allow_print_in_tests: bool
Lint: PRINT_STDOUT, PRINT_STDERR.
Whether print macros (ex. println!
) should be allowed in test functions or #[cfg(test)]
large_error_threshold: u64
Lint: RESULT_LARGE_ERR.
The maximum size of the Err
-variant in a Result
returned from a function
ignore_interior_mutability: Vec<String>
Lint: MUTABLE_KEY_TYPE, IFS_SAME_COND.
A list of paths to types that should be treated like Arc
, i.e. ignored but
for the generic parameters for determining interior mutability
allow_mixed_uninlined_format_args: bool
Lint: UNINLINED_FORMAT_ARGS.
Whether to allow mixed uninlined format args, e.g. format!("{} {}", a, foo.bar)
suppress_restriction_lint_in_const: bool
Lint: INDEXING_SLICING.
Whether 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.
missing_docs_in_crate_items: bool
Lint: MISSING_DOCS_IN_PRIVATE_ITEMS.
Whether to only check for missing documentation in items visible within the current
crate. For example, pub(crate)
items.
future_size_threshold: u64
Lint: LARGE_FUTURES.
The maximum byte size a Future
can have, before it triggers the clippy::large_futures
lint
unnecessary_box_size: u64
Lint: UNNECESSARY_BOX_RETURNS.
The byte size a T
in Box<T>
can have, below which it triggers the clippy::unnecessary_box
lint
allow_private_module_inception: bool
Lint: MODULE_INCEPTION.
Whether to allow module inception if it’s not public.
allowed_idents_below_min_chars: FxHashSet<String>
Lint: MIN_IDENT_CHARS.
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.
min_ident_chars_threshold: u64
Lint: MIN_IDENT_CHARS.
Minimum chars an ident can have, anything below or equal to this will be linted.
accept_comment_above_statement: bool
Lint: UNDOCUMENTED_UNSAFE_BLOCKS.
Whether to accept a safety comment to be placed above the statement containing the unsafe
block
accept_comment_above_attributes: bool
Lint: UNDOCUMENTED_UNSAFE_BLOCKS.
Whether to accept a safety comment to be placed above the attributes for the unsafe
block
allow_one_hash_in_raw_strings: bool
Lint: UNNECESSARY_RAW_STRING_HASHES.
Whether to allow r#""#
when r""
can be used
absolute_paths_max_segments: u64
Lint: ABSOLUTE_PATHS.
The maximum number of segments a path can have before being linted, anything above this will be linted.
absolute_paths_allowed_crates: FxHashSet<String>
Lint: ABSOLUTE_PATHS.
Which crates to allow absolute paths from
allowed_dotfiles: FxHashSet<String>
Lint: PATH_ENDS_WITH_EXT.
Additional dotfiles (files or directories starting with a dot) to allow
allowed_duplicate_crates: FxHashSet<String>
Lint: MULTIPLE_CRATE_VERSIONS.
A list of crate names to allow duplicates of
enforce_iter_loop_reborrow: bool
Lint: EXPLICIT_ITER_LOOP.
Whether 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 {}
check_private_items: bool
Lint: MISSING_SAFETY_DOC, UNNECESSARY_SAFETY_DOC, MISSING_PANICS_DOC, MISSING_ERRORS_DOC.
Whether to also run the listed lints on private items.
pub_underscore_fields_behavior: PubUnderscoreFieldsBehaviour
Lint: PUB_UNDERSCORE_FIELDS.
Lint “public” fields in a struct that are prefixed with an underscore based on their exported visibility, or whether they are marked as “pub”.
allow_comparison_to_zero: bool
Lint: MODULO_ARITHMETIC.
Don’t lint when comparing the result of a modulo operation to zero.
allowed_wildcard_imports: FxHashSet<String>
Lint: WILDCARD_IMPORTS.
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.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl DynSend for Conf
impl DynSync for Conf
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, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Filterable for T
impl<T> Filterable for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<'tcx, T> ToPredicate<'tcx, T> for T
impl<'tcx, T> ToPredicate<'tcx, T> for T
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed ) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
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: 792 bytes