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

Bug: clippy 已经指定了 --no-deps 参数,依然会检查依赖库 #31

Open
zjp-CN opened this issue Aug 10, 2024 · 2 comments
Open
Labels
非本仓库 bug 来自框架、依赖等不属于本仓库能解决的 bug

Comments

@zjp-CN
Copy link
Member

zjp-CN commented Aug 10, 2024

@zjp-CN
Copy link
Member Author

zjp-CN commented Aug 10, 2024

应该是 cargo clippy --no-deps 的 bug:

# 首次检查 axdma,的确报告了依赖项 axalloc 的检查
os-checker/tmp $ cargo clippy --no-deps --manifest-path arceos/modules/axdma/Cargo.toml
warning: you should consider adding a `Default` implementation for `GlobalAllocator`
  --> modules/axalloc/src/lib.rs:57:5
   |                                                                                                                                                                                            57 | /     pub const fn new() -> Self {
58 | |         Self {
59 | |             balloc: SpinNoIrq::new(DefaultByteAllocator::new()),
60 | |             palloc: SpinNoIrq::new(BitmapPageAllocator::new()),
61 | |         }
62 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default                                                                             = note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this                                                                                                                                                                              |
55 + impl Default for GlobalAllocator {
56 +     fn default() -> Self {                                                                                                                                                                 57 +         Self::new()
58 +     }
59 + }
   |

# 如果不指定 --no-deps,报告行为良好
os-checker/tmp $ cargo clippy --manifest-path arceos/modules/axdma/Cargo.toml
   Compiling axconfig v0.1.0 (/rust/my/os-checker/tmp/arceos/modules/axconfig)
    Checking axalloc v0.1.0 (/rust/my/os-checker/tmp/arceos/modules/axalloc)
    Checking axlog v0.1.0 (/rust/my/os-checker/tmp/arceos/modules/axlog)
warning: you should consider adding a `Default` implementation for `GlobalAllocator`
  --> modules/axalloc/src/lib.rs:57:5

# 注意:另一个依赖项 axhal 的检查结果如期显示
warning: you should consider adding a `Default` implementation for `TaskContext`
   --> modules/axhal/src/arch/x86_64/context.rs:148:5

# 第三次运行开始,带 --no-deps,那么不在显式依赖项的报告
os-checker/tmp $ cargo clippy --no-deps --manifest-path arceos/modules/axdma/Cargo.toml
   Compiling axconfig v0.1.0 (/rust/my/os-checker/tmp/arceos/modules/axconfig)
    Checking axalloc v0.1.0 (/rust/my/os-checker/tmp/arceos/modules/axalloc)
    Checking axlog v0.1.0 (/rust/my/os-checker/tmp/arceos/modules/axlog)
   Compiling axhal v0.1.0 (/rust/my/os-checker/tmp/arceos/modules/axhal)
    Checking axmm v0.1.0 (/rust/my/os-checker/tmp/arceos/modules/axmm)
    Checking axdma v0.1.0 (/rust/my/os-checker/tmp/arceos/modules/axdma)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.99s


os-checker/tmp $ cargo clippy --no-deps --manifest-path arceos/modules/axdma/Cargo.toml
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.10

@zjp-CN zjp-CN added the 非本仓库 bug 来自框架、依赖等不属于本仓库能解决的 bug label Aug 10, 2024
@zjp-CN
Copy link
Member Author

zjp-CN commented Aug 11, 2024

Already file this issue to clippy developers on zulipchat: unexpected results of clippy with --no-deps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
非本仓库 bug 来自框架、依赖等不属于本仓库能解决的 bug
Projects
None yet
Development

No branches or pull requests

1 participant