Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy with --no-deps emits unexpected warnings from deps or should have emitted warnings as expected #13983

Open
zjp-CN opened this issue Jan 11, 2025 · 0 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@zjp-CN
Copy link

zjp-CN commented Jan 11, 2025

Summary

Zulipchat: https://rust-lang.zulipchat.com/#narrow/channel/257328-clippy/topic/unexpected.20results.20of.20clippy.20with.20.60--no-deps.60/near/459710102

Reproducer

There is a minimum reproducible repo: https://github.com/os-checker/bug-MRE-clippy-no-deps

echo Bug Case 1

cargo clean
echo expected warning
cargo clippy --no-deps --manifest-path ./a-dep/Cargo.toml
echo unexpected warning from a-dep
cargo clippy --no-deps --manifest-path ./b-dep/Cargo.toml

echo Bug Case 2

cargo clean
echo expected no warning from a-dep
cargo clippy --no-deps --manifest-path ./b-dep/Cargo.toml
echo unexpected no warning
cargo clippy --no-deps --manifest-path ./a-dep/Cargo.toml
// a-dep/src/lib.rs
pub struct A {}

impl A {
    pub fn new() -> A {
        A {}
    }
}
/// b-dep/src/lib.rs
$ sh ./reproducible.sh
Bug Case 1
     Removed 23 files, 56.1KiB total
expected warning
    Checking a-dep v0.1.0 (/rust/tmp/clippy-no-deps/a-dep)
warning: you should consider adding a `Default` implementation for `A`
...

warning: `a-dep` (lib) generated 1 warning (run `cargo clippy --fix --lib -p a-dep` to apply 1 suggestion)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.13s
unexpected warning from a-dep 👈👈👈 only check b-dep, but a-dep's result is included here
warning: you should consider adding a `Default` implementation for `A`
...
warning: `a-dep` (lib) generated 1 warning (run `cargo clippy --fix --lib -p a-dep` to apply 1 suggestion) 
    Checking b-dep v0.1.0 (/rust/tmp/clippy-no-deps/b-dep) 👈👈👈 b-dep is empty without any code!
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.07s
Bug Case 2
     Removed 24 files, 102.4KiB total
expected no warning from a-dep
    Checking a-dep v0.1.0 (/rust/tmp/clippy-no-deps/a-dep)
    Checking b-dep v0.1.0 (/rust/tmp/clippy-no-deps/b-dep)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
unexpected no warning 👈👈👈 only check a-dep, but no result????
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s

Version

rustc 1.85.0-nightly (7f75bfa1a 2024-12-30)
binary: rustc
commit-hash: 7f75bfa1ad4e9a9d33a179a90603001515e91991
commit-date: 2024-12-30
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.6

Additional Labels

No response

@zjp-CN zjp-CN added the C-bug Category: Clippy is not doing the correct thing label Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

1 participant