这段代码来自我的操作系统。
#[global_allocator]
pub static ALLOCATOR: LockedHeap = LockedHeap::empty();克里皮说,这个函数有太多的参数。
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)我认为原因是global_allocator属性或linked_list_allocator机箱,所以我使用它们编写了最低限度的代码。
#![deny(clippy::all)]
#![feature(alloc_error_handler)]
#![feature(start)]
#![feature(lang_items)]
#![no_std]
#[global_allocator]
pub static LIST: linked_list_allocator::LockedHeap = linked_list_allocator::LockedHeap::empty();
#[start]
fn _start(c: isize, v: *const *const u8) -> isize {
3
}
#[alloc_error_handler]
fn oom(_layout: core::alloc::Layout) -> ! {
panic!()
}
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
}
#[lang = "eh_personality"]
fn eh() {}然而,克里皮对此代码只字未提。
为什么克里皮抱怨第一段代码?
发布于 2022-04-13 11:20:26
如果克利皮在正常函数声明中抱怨这一点,请使用上述函数上的#[allow(clippy::too_many_arguments)]属性来消除错误。
https://stackoverflow.com/questions/63933070
复制相似问题