|
| 1 | +# Unfortunately we cannot add any lints based on `cfg(test)` nor `cfg(feature = "feat")`: https://github.com/rust-lang/cargo/issues/8170. |
| 2 | +# Hence, we can only define lints that are applied codebase-wide (including tests), and lints that are applied only to runtime code. |
| 3 | + |
| 4 | +# Codebase-wide lints. |
| 5 | +[target.'cfg(all())'] |
| 6 | +rustflags = [ |
| 7 | + # We need to deny warnings here instead of with the `RUSTFLAGS` env since the env variable would completely override these settings -> https://github.com/rust-lang/cargo/issues/5376. |
| 8 | + "-Dwarnings", |
| 9 | + "-Wclippy::as_underscore", |
| 10 | + "-Wclippy::assertions_on_result_states", |
| 11 | + "-Wclippy::branches_sharing_code", |
| 12 | + "-Wclippy::clear_with_drain", |
| 13 | + "-Wclippy::clone_on_ref_ptr", |
| 14 | + "-Wclippy::collection_is_never_read", |
| 15 | + "-Wclippy::derive_partial_eq_without_eq", |
| 16 | + "-Wclippy::else_if_without_else", |
| 17 | + "-Wclippy::empty_drop", |
| 18 | + "-Wclippy::empty_structs_with_brackets", |
| 19 | + "-Wclippy::equatable_if_let", |
| 20 | + "-Wclippy::if_then_some_else_none", |
| 21 | + "-Wclippy::impl_trait_in_params", |
| 22 | + "-Wclippy::iter_on_empty_collections", |
| 23 | + "-Wclippy::iter_on_single_items", |
| 24 | + "-Wclippy::iter_with_drain", |
| 25 | + "-Wclippy::needless_collect", |
| 26 | + "-Wclippy::needless_pass_by_ref_mut", |
| 27 | + "-Wclippy::negative_feature_names", |
| 28 | + "-Wclippy::option_if_let_else", |
| 29 | + "-Wclippy::or_fun_call", |
| 30 | + "-Wclippy::pub_without_shorthand", |
| 31 | + "-Wclippy::redundant_clone", |
| 32 | + "-Wclippy::redundant_type_annotations", |
| 33 | + "-Wclippy::ref_patterns", |
| 34 | + "-Wclippy::rest_pat_in_fully_bound_structs", |
| 35 | + "-Wclippy::suspicious_operation_groupings", |
| 36 | + "-Wclippy::tests_outside_test_module", |
| 37 | + "-Wclippy::type_repetition_in_bounds", |
| 38 | + "-Wclippy::unnecessary_self_imports", |
| 39 | + "-Wclippy::unnecessary_struct_initialization", |
| 40 | + "-Wclippy::unneeded_field_pattern", |
| 41 | + "-Wclippy::unused_peekable", |
| 42 | + "-Wclippy::useless_let_if_seq", |
| 43 | + "-Wclippy::wildcard_dependencies", |
| 44 | + # TODO: Add after upgrading to 1.76 |
| 45 | + # "-Wclippy::infinite_loop", |
| 46 | + # TODO: Add after upgrading to 1.77 |
| 47 | + #"-Wclippy::empty_enum_variants_with_brackets" |
| 48 | + # TODO: Add after upgrading to 1.80 |
| 49 | + #"-Wclippy::renamed_function_params" |
| 50 | + # TODO: Add after upgrading to 1.81 |
| 51 | + #"-Wclippy::cfg_not_test" |
| 52 | + #"-Wclippy::allow_attributes", |
| 53 | + # "-Wclippy::allow_attributes_without_reason", |
| 54 | + # TODO: Add after upgrading to 1.83 |
| 55 | + #"-Wclippy::unused_trait_names" |
| 56 | +] |
| 57 | + |
| 58 | +# Deployment runtime lints. |
| 59 | +[target.'cfg(target_arch = "wasm32")'] |
| 60 | +rustflags = [ |
| 61 | + "-Dclippy::arithmetic_side_effects", |
| 62 | + "-Dclippy::as_conversions", |
| 63 | + "-Dclippy::assertions_on_result_states", |
| 64 | + "-Dclippy::cast_possible_wrap", |
| 65 | + "-Dclippy::dbg_macro", |
| 66 | + "-Dclippy::expect_used", |
| 67 | + "-Dclippy::float_arithmetic", |
| 68 | + "-Dclippy::float_cmp_const", |
| 69 | + "-Dclippy::index_refutable_slice", |
| 70 | + "-Dclippy::indexing_slicing", |
| 71 | + "-Dclippy::lossy_float_literal", |
| 72 | + "-Dclippy::modulo_arithmetic", |
| 73 | + "-Dclippy::panic", |
| 74 | + "-Dclippy::string_slice", |
| 75 | + "-Dclippy::todo", |
| 76 | + "-Dclippy::unimplemented", |
| 77 | + "-Dclippy::unreachable", |
| 78 | + "-Dclippy::unwrap_used", |
| 79 | + "-Funsafe_code", |
| 80 | + "-Wclippy::alloc_instead_of_core", |
| 81 | + "-Wclippy::decimal_literal_representation", |
| 82 | + "-Wclippy::default_numeric_fallback", |
| 83 | + "-Wclippy::error_impl_error", |
| 84 | + "-Wclippy::integer_division", |
| 85 | + "-Wclippy::let_underscore_must_use", |
| 86 | + "-Wclippy::let_underscore_untyped", |
| 87 | + "-Wclippy::missing_const_for_fn", |
| 88 | + "-Wclippy::mixed_read_write_in_expression", |
| 89 | + "-Wclippy::print_stderr", |
| 90 | + "-Wclippy::print_stdout", |
| 91 | + "-Wclippy::shadow_reuse", |
| 92 | + "-Wclippy::shadow_same", |
| 93 | + "-Wclippy::shadow_unrelated", |
| 94 | + "-Wclippy::str_to_string", |
| 95 | + "-Wclippy::string_slice", |
| 96 | + "-Wclippy::string_to_string", |
| 97 | +] |
0 commit comments