Context: Cargo.toml declares [workspace.lints.rust] and [workspace.lints.clippy] with
serious rules (cast_possible_truncation = "deny", pointer safety, stack-overflow
prevention). Each crate opts in via [lints] workspace = true. However, Buck2's
rust_library / rust_binary does not read Cargo.toml — so these lints are almost
certainly unenforced when running just check / just clippy.
Scope:
- Verify the finding. Write a small test: introduce a deliberate
cast_possible_truncationviolation in a throwaway branch of one crate, runjust clippy, and confirm it passes. Compare withcargo clippywhich should fail. - Create
build/lints.bzlexportingRUSTC_FLAGS_LINTSandCLIPPY_FLAGS_LINTSas lists mirroring the Cargo.toml block. - Wire into
build/rust.bzlsorust_library/rust_binaryapply them viarustc_flags. Make overridable per-target for the burn-down period. - Delete
[workspace.lints]fromCargo.toml(or leave a stub comment pointing atbuild/lints.bzl). Single source of truth. - Run
just clippyand fix or triage the fallout. File follow-up issues per crate for the burn-down.
Acceptance: just clippy fails on a deliberately-introduced lint violation.