相关疑难解决方法(0)

如何在Rust中禁用未使用的代码警告?

struct SemanticDirection;

fn main() {}
Run Code Online (Sandbox Code Playgroud)
warning: struct is never used: `SemanticDirection`
 --> src/main.rs:1:1
  |
1 | struct SemanticDirection;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(dead_code)] on by default
Run Code Online (Sandbox Code Playgroud)

我会将这些警告重新发送给任何严肃的事情,但我只是在修补这种语言而这正在驱使我蝙蝠.

我尝试添加#[allow(dead_code)]到我的代码,但这不起作用.

warnings dead-code compiler-warnings rust

179
推荐指数
8
解决办法
6万
查看次数

标签 统计

compiler-warnings ×1

dead-code ×1

rust ×1

warnings ×1