File
Blob: build/rust_lint.bazelrc
| 1 | ## rust lint configuration |
| 2 | |
| 3 | # turn rust warnings into errors |
| 4 | build:lint --@rules_rust//:extra_rustc_flag=-Dwarnings |
| 5 | |
| 6 | |
| 7 | # enable clippy checks during build |
| 8 | build:rust-enable-clippy-checks --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect |
| 9 | build:rust-enable-clippy-checks --output_groups=+clippy_checks |
| 10 | |
| 11 | # configure clippy |
| 12 | |
| 13 | # rationale for disabling checks: |
| 14 | # - clippy::missing_const_for_fn - too annoying in practice |
| 15 | # - clippy::option_if_let_else - arguably if else is easier to read |
| 16 | # - clippy::trait_duplication_in_bounds - ffi trips this |
| 17 | # - clippy::non_send_fields_in_send_ty - ffi trips this |
| 18 | # - clippy::cognitive_complexity - even tests trigger this |
| 19 | # - clippy::future_not_send - todo |
| 20 | # - clippy::trivial_regex - there's nothing wrong with having trivial regex |
| 21 | # - clippy::literal_string_with_formatting_args โ somehow triggers on |
| 22 | # external/rules_rust+/rust/settings/.clippy.toml |
| 23 | # - clippy::non_std_lazy_statics โ triggers on lazy_static, non-trivial to replace |
| 24 | # - clippy::format_push_string โ avoids single memory allocation, but makes code less readable |
| 25 | # - clippy::cast_possible_truncation - usize/u64 conversion warning is unbelievably noisy |
| 26 | build:rust-enable-clippy-checks --@rules_rust//:clippy_flags=-Wclippy::pedantic,-Wclippy::redundant_clone,-Wclippy::str_to_string,-Wclippy::to_string_in_format_args,-Wclippy::unnecessary_to_owned,-Wclippy::implicit_clone,-Wclippy::suspicious_to_owned,-Wclippy::unnecessary_to_owned,-Wclippy::nursery,-Wclippy::dbg_macro,-Wclippy::unwrap_used,-Wclippy::allow_attributes,-Wclippy::undocumented_unsafe_blocks,-Wclippy::fn_params_excessive_bools,-Aclippy::missing_const_for_fn,-Aclippy::cognitive_complexity,-Aclippy::trait_duplication_in_bounds,-Aclippy::non_send_fields_in_send_ty,-Aclippy::option_if_let_else,-Aclippy::missing_errors_doc,-Aclippy::must_use_candidate,-Aclippy::future_not_send,-Aclippy::trivial_regex,-Aclippy::literal_string_with_formatting_args,-Aclippy::non_std_lazy_statics,-Aclippy::format_push_string,-Aclippy::cast_possible_truncation,-Dwarnings |
| 27 | build --@rules_rust//rust/settings:clippy.toml=//src/rust:clippy.toml |
| 28 | |
| 29 | # enable rustfmt checks |
| 30 | build:rust-enable-rustfmt-checks --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect |
| 31 | build:rust-enable-rustfmt-checks --output_groups=+rustfmt_checks |
| 32 | # configure rustfmt |
| 33 | build --@rules_rust//:rustfmt.toml=//src/rust:rustfmt.toml |
| 34 | |
| 35 | # enable clippy & rustfmt checks in lint configuration |
| 36 | build:lint --config=rust-enable-clippy-checks --config=rust-enable-rustfmt-checks |
| 37 | |
| 38 | # convenience shortcuts |
| 39 | build:clippy --config=rust-enable-clippy-checks |
| 40 | build:rustfmt --config=rust-enable-rustfmt-checks |