Cargo [lints] not respected

Hello. I am using the Cargo [lints] feature that was recently stabilized in 1.74. I have this in my root Cargo.toml

name = "foo"
version = "0.1.0"
edition = "2021"


#nix = { git = "file:////path/to/foo/crates/nix", features = ["feature", "ptrace", "process", "uio"] }
nix = { path = "crates/nix", features = ["feature", "ptrace", "process", "uio"] }


members = ["crates/*"]

unsafe_code = "allow"
trivial_casts = "allow"
trivial_numeric_casts = "allow"

workspace = true

And in crates/nix/Cargo.toml I have:

workspace = true

And I still keep errors when I run cargo build for the lints I have allowed. The main problem I see is rustc keeps getting the -D flags even for the ones I have allowed:

/home/ubuntu/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/bin/rustc \
  --crate-name nix --edition=2021 crates/nix/src/ --error-format=json \
  --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=157 \
  --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 \
  --allow=unsafe_code --allow=trivial_numeric_casts --allow=trivial_casts \
  --cfg 'feature="default"' --cfg 'feature="feature"' --cfg 'feature="process"' --cfg 'feature="ptrace"' \
  --cfg 'feature="uio"' -C metadata=e3f6e9b19a97f0b5 -C extra-filename=-e3f6e9b19a97f0b5 \
  --out-dir /path/to/foo/target/debug/deps -C incremental=/path/to/foo/target/debug/incremental \
  -L dependency=/path/to/foo/target/debug/deps \
  --extern bitflags=/path/to/foo/target/debug/deps/libbitflags-35e551d87aae76df.rmeta \
  --extern cfg_if=/path/to/foo/target/debug/deps/libcfg_if-60e6d5601ab4f054.rmeta \
  --extern libc=/path/to/foo/target/debug/deps/liblibc-d99c089f17adab88.rmeta \
  -Aunsafe-code \
  '-Dclippy::all' \
  -Ddead-code -Ddeprecated -Dfuture-incompatible -Dimproper-ctypes \
  -Dmissing-debug-implementations -Dno-mangle-generic-items \
  -Dnon-shorthand-field-patterns -Dnonstandard-style -Doverflowing-literals \
  -Dpath-statements -Dpatterns-in-fns-without-body -Dprivate-in-public \
  -Drust-2018-idioms -Dtrivial-casts -Dtrivial-numeric-casts -Dunconditional-recursion \
  -Dunsafe-code -Dunused -Dunused-allocation -Dunused-comparisons \
  -Dunused-extern_crates -Dunused-import_braces -Dunused-parens

What am I missing?

EDIT: Oddly I don't have this problem if I use git dependency (currently commented) in my Cargo.toml instead of a path dependency.

(removed because I misread your post)

I guess in this case Cargo doesn't even look at the fact that the dependency is in the same workspace and suppresses all lints for nix, as it would do for any external dependency.

I see. That makes sense. How do I make it suppress specific lints for nix when it is a path dependency?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.