Last active
August 10, 2025 15:29
-
-
Save Dragonink/0183a3c0e184191e98ac995e0221f3c9 to your computer and use it in GitHub Desktop.
Useful Rust lints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [lints.rust] | |
| # Correctness | |
| let-underscore = "deny" | |
| meta_variable_misuse = "deny" | |
| missing_abi = "forbid" | |
| unsafe_attr_outside_unsafe = "forbid" | |
| unsafe_op_in_unsafe_fn = "forbid" | |
| unused_must_use = "deny" | |
| # Restriction | |
| missing_docs = "warn" | |
| unsafe_code = "forbid" | |
| # Suspicious | |
| missing_copy_implementations = "warn" | |
| missing_debug_implementations = "warn" | |
| redundant_imports = "warn" | |
| redundant_lifetimes = "warn" | |
| unit_bindings = "warn" | |
| unnameable_types = "warn" | |
| unreachable_pub = "warn" | |
| unused = { level = "warn", priority = -1 } | |
| unused_crate_dependencies = "warn" | |
| # Style | |
| non_ascii_idents = "deny" | |
| unused_import_braces = "warn" | |
| unused_lifetimes = "warn" | |
| unused_qualifications = "warn" | |
| [lints.clippy] | |
| # Restriction | |
| allow_attributes = "warn" | |
| allow_attributes_without_reason = "warn" | |
| as_pointer_underscore = "deny" | |
| assertions_on_result_states = "warn" | |
| clone_on_ref_ptr = "warn" | |
| create_dir = "warn" | |
| dbg_macro = "warn" | |
| default_union_representation = "deny" | |
| deref_by_slicing = "warn" | |
| disallowed_macros = "deny" | |
| disallowed_methods = "deny" | |
| disallowed_types = "deny" | |
| doc_include_without_cfg = "warn" | |
| empty_enum_variants_with_brackets = "warn" | |
| empty_structs_with_brackets = "warn" | |
| exhaustive_enums = "warn" | |
| exhaustive_structs = "warn" | |
| exit = "deny" | |
| filetype_is_file = "warn" | |
| float_cmp_const = "warn" | |
| fn_to_numeric_cast = "warn" | |
| get_unwrap = "warn" | |
| if_then_some_else_none = "warn" | |
| impl_trait_in_params = "warn" | |
| infinite_loop = "warn" | |
| let_underscore_must_use = "deny" | |
| let_underscore_untyped = "warn" | |
| lossy_float_literal = "warn" | |
| map_err_ignore = "warn" | |
| map_with_unused_argument_over_ranges = "warn" | |
| mem_forget = "deny" | |
| missing_assert_message = "warn" | |
| missing_docs_in_private_items = "warn" | |
| missing_inline_in_public_items = "warn" | |
| mod_module_files = "warn" | |
| module_name_repetitions = "warn" | |
| multiple_unsafe_ops_per_block = "forbid" | |
| mutex_atomic = "warn" | |
| mutex_integer = "warn" | |
| needless_raw_strings = "warn" | |
| non_zero_suggestions = "warn" | |
| pathbuf_init_then_push = "warn" | |
| pattern_type_mismatch = "warn" | |
| print_stderr = "warn" | |
| print_stdout = "warn" | |
| pub_without_shorthand = "warn" | |
| rc_buffer = "warn" | |
| rc_mutex = "warn" | |
| redundant_type_annotations = "warn" | |
| rest_pat_in_fully_bound_structs = "warn" | |
| semicolon_outside_block = "warn" | |
| str_to_string = "warn" | |
| string_lit_chars_any = "warn" | |
| string_slice = "warn" | |
| string_to_string = "warn" | |
| tests_outside_test_module = "warn" | |
| todo = "warn" | |
| try_err = "warn" | |
| undocumented_unsafe_blocks = "forbid" | |
| unnecessary_safety_comment = "warn" | |
| unnecessary_safety_doc = "warn" | |
| unnecessary_self_imports = "warn" | |
| unneeded_field_pattern = "warn" | |
| unseparated_literal_suffix = "warn" | |
| unused_result_ok = "warn" | |
| unused_trait_names = "warn" | |
| unwrap_used = "warn" | |
| verbose_file_reads = "warn" | |
| # Pedantic | |
| pedantic = { level ="warn", priority = -1 } | |
| must_use_candidate = "allow" | |
| # Nursery | |
| nursery = { level = "warn", priority = -1 } | |
| redundant_pub_crate = "allow" | |
| # Cargo | |
| cargo = { level = "warn", priority = -1 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| check-private-items = true | |
| disallowed-methods = [ | |
| { path = "alloc::boxed::Box::leak", reason = "do not leak memory" }, | |
| { path = "alloc::vec::Vec::leak", reason = "do not leak memory" }, | |
| { path = "alloc::string::String::leak", reason = "do not leak memory" }, | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment