clippy_config

Struct Conf

source
pub struct Conf {
Show 77 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_expect_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_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<DisallowedPath>, pub blacklisted_names: Vec<String>, pub cargo_ignore_publish: bool, pub check_private_items: bool, pub cognitive_complexity_threshold: u64, 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 large_error_threshold: u64, 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_in_crate_items: bool, pub msrv: Msrv, pub pass_by_value_size_limit: u64, pub pub_underscore_fields_behavior: PubUnderscoreFieldsBehaviour, pub semicolon_inside_block_ignore_singleline: bool, pub semicolon_outside_block_ignore_multiline: bool, pub single_char_binding_names_threshold: u64, 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 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: u64

The maximum number of segments a path can have before being linted, anything above this will be linted.

§accept_comment_above_attributes: bool

Whether to accept a safety comment to be placed above the attributes for the unsafe block

§accept_comment_above_statement: bool

Whether to accept a safety comment to be placed above the statement containing the unsafe block

§allow_comparison_to_zero: bool

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

§allow_dbg_in_tests: bool

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

§allow_expect_in_tests: bool

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

§allow_mixed_uninlined_format_args: bool

Whether to allow mixed uninlined format args, e.g. format!("{} {}", a, foo.bar)

§allow_one_hash_in_raw_strings: bool

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

§allow_panic_in_tests: bool

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

§allow_print_in_tests: bool

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

§allow_private_module_inception: bool

Whether 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_tests: bool

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

§allow_useless_vec_in_tests: bool

Whether 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_into and try_from
  • PascalCase variant is included automatically for each snake_case variant (e.g. if try_into is included, TryInto will 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
  1. This configuration has no effects if used with warn_on_all_wildcard_imports = true.
  2. 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: u64

The maximum allowed size for arrays on the stack

§avoid_breaking_exported_api: bool

Suppress lints whenever the suggested change would cause breakage for other crates.

§await_holding_invalid_types: Vec<DisallowedPath>

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: bool

For internal testing only, ignores the current publish settings in the Cargo manifest.

§check_private_items: bool

Whether to also run the listed lints on private items.

§cognitive_complexity_threshold: u64

The maximum cognitive complexity a function can have

§cyclomatic_complexity_threshold: u64

DEPRECATED LINT: CYCLOMATIC_COMPLEXITY.

Use the Cognitive Complexity lint instead.

§disallowed_macros: Vec<DisallowedPath>

The list of disallowed macros, written as fully qualified paths.

§disallowed_methods: Vec<DisallowedPath>

The list of disallowed methods, written as fully qualified paths.

§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.

§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 append ClipPy to the default list.
§enable_raw_pointer_heuristic_for_send: bool

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

§enforce_iter_loop_reborrow: bool

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 {}
§enforced_import_renames: Vec<Rename>

The list of imports to always rename, a fully qualified path followed by the rename.

§enum_variant_name_threshold: u64

The minimum number of enum variants for the lints about variant names to trigger

§enum_variant_size_threshold: u64

The maximum size of an enum’s variant to avoid box suggestion

§excessive_nesting_threshold: u64

The maximum amount of nesting a block can reside in

§future_size_threshold: u64

The 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

§large_error_threshold: u64

The maximum size of the Err-variant in a Result returned from a function

§literal_representation_threshold: u64

The lower bound for linting decimal literals

§matches_for_let_else: MatchLintBehaviour

Whether the matches should be considered by the lint, and whether there should be filtering for common types.

§max_fn_params_bools: u64

The maximum number of bool parameters a function can have

§max_include_file_size: u64

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

§max_struct_bools: u64

The maximum number of bool fields a struct can have

§max_suggested_slice_pattern_length: u64

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.

§max_trait_bounds: u64

The maximum number of bounds a trait can have to be linted

§min_ident_chars_threshold: u64

Minimum chars an ident can have, anything below or equal to this will be linted.

§missing_docs_in_crate_items: bool

Whether to only check for missing documentation in items visible within the current crate. For example, pub(crate) items.

§msrv: Msrv

The minimum rust version that the project supports. Defaults to the rust-version field in Cargo.toml

§pass_by_value_size_limit: u64

The minimum size (in bytes) to consider a type for passing by reference instead of by value.

§pub_underscore_fields_behavior: PubUnderscoreFieldsBehaviour

Lint “public” fields in a struct that are prefixed with an underscore based on their exported visibility, or whether they are marked as “pub”.

§semicolon_inside_block_ignore_singleline: bool

Whether to lint only if it’s multiline.

§semicolon_outside_block_ignore_multiline: bool

Whether to lint only if it’s singleline.

§single_char_binding_names_threshold: u64

The maximum number of single char bindings a scope may have

§stack_size_threshold: u64

The 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: u64

The minimum number of struct fields for the lints about field names to trigger

§suppress_restriction_lint_in_const: bool

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.

§too_large_for_stack: u64

The maximum size of objects (in bytes) that will be linted. Larger objects are ok on the heap

§too_many_arguments_threshold: u64

The maximum number of argument a function or method can have

§too_many_lines_threshold: u64

The maximum number of lines a function or method can have

§trivial_copy_size_limit: Option<u64>

The maximum size (in bytes) to consider a Copy type for passing by value instead of by reference. By default there is no limit

§type_complexity_threshold: u64

The maximum complexity a type can have

§unnecessary_box_size: u64

The byte size a T in Box<T> can have, below which it triggers the clippy::unnecessary_box lint

§unreadable_literal_lint_fractions: bool

Should the fraction of a decimal be linted to include separators.

§upper_case_acronyms_aggressive: bool

Enables verbose mode. Triggers if there is more than one uppercase char next to each other

§vec_box_size_threshold: u64

The size of the boxed type in bytes, where boxing in a Vec is allowed

§verbose_bit_mask_threshold: u64

The maximum allowed size of a bit mask before suggesting to use ‘trailing_zeros’

§warn_on_all_wildcard_imports: bool

Whether to allow certain wildcard imports (prelude, super in tests).

§warn_unsafe_macro_metavars_in_private_macros: bool

Whether to also emit warnings for unsafe blocks with metavariable expansions in private macros.

Implementations§

source§

impl Conf

source

pub fn read( sess: &Session, path: &Result<(Option<PathBuf>, Vec<String>)>, ) -> &'static Conf

source

fn read_inner( sess: &Session, path: &Result<(Option<PathBuf>, Vec<String>)>, ) -> Conf

Trait Implementations§

source§

impl Default for Conf

source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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