该代码来自我的操作系统。
#[global_allocator]
pub static ALLOCATOR: LockedHeap = LockedHeap::empty();
Run Code Online (Sandbox Code Playgroud)
Clippy 说这个函数有太多参数。
error: this function has too many arguments (4/3)
--> src/mem/allocator/heap.rs:14:1
|
14 | pub static ALLOCATOR: LockedHeap = LockedHeap::empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> src/lib.rs:14:9
|
14 | #![deny(clippy::all)]
| ^^^^^^^^^^^
= note: `#[deny(clippy::too_many_arguments)]` implied by `#[deny(clippy::all)]`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
Run Code Online (Sandbox Code Playgroud)
我认为原因是global_allocator属性或linked_list_allocator板条箱,所以我使用它们编写了最少的代码。
error: this function has too many arguments (4/3)
--> src/mem/allocator/heap.rs:14:1
|
14 | pub static ALLOCATOR: LockedHeap = LockedHeap::empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> src/lib.rs:14:9
|
14 | #![deny(clippy::all)]
| ^^^^^^^^^^^
= note: `#[deny(clippy::too_many_arguments)]` implied by `#[deny(clippy::all)]`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
Run Code Online (Sandbox Code Playgroud)
然而,clippy 对这段代码只字未提。
为什么 Clippy 抱怨第一个代码?
| 归档时间: |
|
| 查看次数: |
3413 次 |
| 最近记录: |