os-checker / os-checker.github.io

https://os-checker.github.io
MIT License
0 stars 0 forks source link

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

Open zjp-CN opened 1 month ago

zjp-CN commented 1 month ago

os-checker 相关代码:https://github.com/os-checker/os-checker/blob/50faf092c08b39184e6ccd838cc328d63b7b0075/src/repo/cmd.rs#L17-L26

问题库之一:https://github.com/arceos-org/arceos/blob/6f98bc411e4c799085739ebb9ef4de28de4e7f30/modules/axdma/Cargo.toml#L19

截图_20240810155919

zjp-CN commented 1 month ago

应该是 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 commented 1 month ago

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