Skip to content

Commit d7e3398

Browse files
committed
Ignore unexpected_cfgs lint for generated code
``` error: unexpected `cfg` condition name: `rustfmt` --> src/gen/assert_impl.rs:6:13 | 6 | #![cfg_attr(rustfmt, rustfmt::skip)] | ^^^^^^^ ``` Due to rust-lang/rust#124735, we cannot disable this lint at module-level.
1 parent 2b1c762 commit d7e3398

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ target-spec-json = "0.1"
3636
// clippy::std_instead_of_alloc,
3737
clippy::std_instead_of_core,
3838
)]
39+
#![cfg_attr(test, allow(unexpected_cfgs))] // https://github.com/rust-lang/rust/issues/124735
3940

4041
#[cfg(test)]
4142
#[path = "gen/assert_impl.rs"]

tools/codegen/src/file.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ pub(crate) fn workspace_root() -> PathBuf {
3333
#[track_caller]
3434
pub(crate) fn header(function_name: &str) -> String {
3535
// rust-analyzer does not respect outer attribute (#[rustfmt::skip]) on
36-
// a module without a body. So use inner attribute under cfg(rustfmt).
36+
// a module without a body and unstable ignore option in .rustfmt.toml.
37+
// https://github.com/rust-lang/rust-analyzer/issues/10826
38+
// So use inner attribute under cfg(rustfmt).
3739
format!(
3840
"// SPDX-License-Identifier: Apache-2.0 OR MIT
3941
// This file is @generated by {bin_name}

0 commit comments

Comments
 (0)