这不是在谷歌上,所以我恳请某人如何压制这个警告:

342 |     BAYER_RGGB16,
    |     ^^^^^^^^^^^^ help: convert the identifier to upper camel case: `BayerRggb16`

#[allow(non_snake_case)]不起作用.

推荐答案

您正在寻找non-camel-case-types号皮棉选项.rustc -W help中对该支票的描述如下:

                           name default meaning
non-camel-case-types warn types, variants, traits and type parameters should have camel case names

在您的代码片段中,BAYER_RGGB16似乎是一个枚举变量,因此默认的lint选项要求它在(上)CamelCase中命名.lint attribute #[allow(non_camel_case_types)]可禁用该判断:

// Can also be applied to the whole enum, instead of just one variant.
// #[allow(non_camel_case_types)]
enum MyEnum {

    // ...

    #[allow(non_camel_case_types)]
    BAYER_RGGB16,
}

Try it yourself人在Rust 的操场上.

Rust相关问答推荐

你是如何在铁 rust 一侧的金牛座获得应用程序版本的?

在我的Cargo 中,当我在建筑物中使用时,找不到我可以在产品包中使用的 crate .r我如何解决这个问题?

一种随机局部搜索算法的基准(分数)

Trait bound i8:来自u8的不满意

循环访问枚举中的不同集合

什么时候使用FuturesOrdered?

链表堆栈溢出

如何使用reqwest进行异步请求?

通过异常从同步代码中产生yield 是如何工作的?

是否可以在不直接重复的情况下为许多特定类型实现一个函数?

try 实现线程安全的缓存

如何强制匹配的返回类型为()?

信号量释放后 Rust 输出挂起线程

在 Rust 中,在第一个空格上分割字符串一次

Rust 中的内存管理

使用 Rust 从 Raspberry Pi Pico 上的 SPI 读取值

第 7.4 章片段中如何定义 `thread_rng`

返回引用字符串的future

火箭整流罩、tokio-scheduler 和 cron 的生命周期问题

为什么 Bevy 的 Trait 边界不满足 Rapier 物理插件?