#[allow(dead_code)]是一个 Rust 编程语言中的属性(attribute)。 它的作用是告诉编译器忽略那些没有被使用到的代码,防止编译器在编译过程中对这些代码发出警告。具体来说,当你在代码中定义了某些函数、变量或模块但没有使用它们时,编译器通常会发出警告提示未使用的代码,但加上#[allow(dead_code)]后,编译器会...
// 需要 `allow` 来消除警告,因为只使用了一个变量 #[allow(dead_code)] enumColor{ Red, Blue, Green, RGB(u32,u32,u32), HSV(u32,u32,u32), HSL(u32,u32,u32) } fnmain() { letcolor=Color::RGB(122,17,40); println!("what color is it ?"); matchcolor{ Color::Red=>println!
When this setting is true, dead_code would analyze an entire workspace, checking that all code is used somewhere in the workspace. This is particularly useful in projects that have libraries (for compilation speed or modularity reasons) that are never intended to be published. In those cases, ...
rust-analyzer version: 0.3.1657-standalone (326f37e 2023-09-10 rustc version: rustc 1.72.0 (5680fa18f 2023-08-23) Based on #15528 I assumed this would be possible. My code currently has a rust_analyzer_fix feature we've defined and been ...
#[allow(dead_code)] // TODO(https://github.com/rust-lang/rust/issues/120770): Remove when false positive is fixed. #[derive(Copy, Clone)] #[repr(transparent)] struct RecordFieldWrapper(RecordField); #[allow(dead_code)] // TODO(https://github.com/rust-lang/rust/issues/120770): Remov...
Hello@Xuanwo I have removed the#[allow(dead_code)]from the codebase, I have raised a PR Warnings still exist though - should I remove those functions which are not used? #421 These are the warning functions warning: functionvisitis never used --> crates/iceberg/src/avro/schema.rs:297:...
tests/ui/lint/dead-code allow-unconstructed-pub-struct.rs 2 changes: 1 addition & 1 deletion 2 compiler/rustc_passes/src/dead.rs Original file line numberDiff line numberDiff line change @@ -898,7 +898,7 @@ fn create_and_seed_worklist( ...
This fixes that by adding `#[allow(dead_code)]` to `#[wasm_bindgen]`'d functions to supress the warning. * fix syntax error on rust 1.56 I'm not sure what exactly was invalid about it, but `quote! { ... }.to_tokens(...)` was causing syntax errors on Rust 1.56 in CI for...
rust-lang / rust Public Notifications Fork 12.1k Star 94.2k Code Issues 5k+ Pull requests 653 Actions Projects 5 Security Insights CI Add pub struct with allow(dead_code) into worklist #126710 Sign in to view logs Summary Jobs Calculate job matrix PR - mingw-check PR - ...
allow(dead_code)#994 Merged tamird merged 1 commit into aya-rs:main from tamird:remove-ignore Jul 18, 2024 +0 −2 Conversation 1 Commits 1 Checks 20 Files changed 1 ConversationMember tamird commented Jul 18, 2024 See rust-lang/rust@31fe962.Remove unused allow(dead_code) … ...