Skip to content

Commit

Permalink
Ignore more lints at workspace level
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jun 1, 2024
1 parent 3715ace commit 861ad6f
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 44 deletions.
12 changes: 11 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ improper_ctypes_definitions = "warn"
non_ascii_idents = "warn"
rust_2018_idioms = "warn"
single_use_lifetimes = "warn"
unexpected_cfgs = { level = "warn", check-cfg = [
"cfg(target_arch,values(\"xtensa\"))",
"cfg(target_pointer_width,values(\"128\"))",
# Known custom cfgs, excluding those that may be set by build script.
# Not public API.
"cfg(portable_atomic_test_outline_atomics_detect_false,qemu,valgrind)",
# Public APIs, considered unstable unless documented in readme.
"cfg(portable_atomic_no_outline_atomics,portable_atomic_outline_atomics)",
] }
unreachable_pub = "warn"
# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV
[workspace.lints.clippy]
Expand All @@ -129,12 +138,13 @@ borrow_as_ptr = { level = "allow", priority = 1 } # https://github.com/rust-lang
declare_interior_mutable_const = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7665
doc_markdown = { level = "allow", priority = 1 }
float_cmp = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7725
incompatible_msrv = { level = "allow", priority = 1 } # buggy: doesn't consider cfg, https://github.com/rust-lang/rust-clippy/issues/12280, https://github.com/rust-lang/rust-clippy/issues/12257#issuecomment-2093667187
lint_groups_priority = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/12270
manual_assert = { level = "allow", priority = 1 }
manual_range_contains = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/6455#issuecomment-1225966395
missing_errors_doc = { level = "allow", priority = 1 }
module_name_repetitions = { level = "allow", priority = 1 }
nonminimal_bool = { level = "allow", priority = 1 } # buggy https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+nonminimal_bool
nonminimal_bool = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+nonminimal_bool
similar_names = { level = "allow", priority = 1 }
single_match = { level = "allow", priority = 1 }
single_match_else = { level = "allow", priority = 1 }
Expand Down
1 change: 0 additions & 1 deletion bench/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
unexpected_cfgs,
unused_extern_crates,
clippy::duplicate_mod,
clippy::incompatible_msrv, // similar to https://github.com/rust-lang/rust-clippy/issues/12257, but for bench
clippy::inline_always,
clippy::naive_bytecount,
clippy::wildcard_imports
Expand Down
8 changes: 0 additions & 8 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,10 @@ fn main() {
};

if version.minor >= 80 {
println!(r#"cargo:rustc-check-cfg=cfg(target_pointer_width,values("128"))"#);
println!(r#"cargo:rustc-check-cfg=cfg(target_arch,values("xtensa"))"#);
println!(
r#"cargo:rustc-check-cfg=cfg(target_feature,values("lse2","lse128","rcpc3","quadword-atomics","fast-serialization","load-store-on-cond","distinct-ops","miscellaneous-extensions-3"))"#
);

// Known custom cfgs, excluding those that may be set by build script.
// Not public API.
println!("cargo:rustc-check-cfg=cfg(portable_atomic_test_outline_atomics_detect_false,qemu,valgrind)");
// Public APIs, considered unstable unless documented in readme.
println!("cargo:rustc-check-cfg=cfg(portable_atomic_no_outline_atomics,portable_atomic_outline_atomics)");

// Custom cfgs set by build script. Not public API.
// grep -E 'cargo:rustc-cfg=' build.rs | grep -v '=//' | sed -E 's/^.*cargo:rustc-cfg=//; s/(=\\)?".*$//' | LC_ALL=C sort -u | tr '\n' ','
println!(
Expand Down
3 changes: 2 additions & 1 deletion portable-atomic-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ targets = ["x86_64-unknown-linux-gnu"]

[package.metadata.cargo_check_external_types]
# The following are external types that are allowed to be exposed in our public API.
allowed_external_types = []
allowed_external_types = [
]

[lib]
doc-scrape-examples = false
Expand Down
3 changes: 0 additions & 3 deletions portable-atomic-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ See [#1] for other primitives being considered for addition to this crate.
clippy::std_instead_of_alloc,
clippy::std_instead_of_core,
)]
#![allow(
clippy::incompatible_msrv, // false positive: this lint doesn't consider cfg
)]
// docs.rs only (cfg is enabled by docs.rs, not build script)
#![cfg_attr(docsrs, feature(doc_cfg))]

Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ RUSTFLAGS="--cfg portable_atomic_no_outline_atomics" cargo ...
#![cfg_attr(not(portable_atomic_no_asm), warn(missing_docs))] // module-level #![allow(missing_docs)] doesn't work for macros on old rustc
#![allow(
clippy::cast_lossless,
clippy::incompatible_msrv, // false positive: this lint doesn't consider cfg
clippy::inline_always,
clippy::naive_bytecount,
clippy::unreadable_literal
Expand Down
2 changes: 1 addition & 1 deletion tests/api-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "api-test"
version = "0.0.0"
edition = "2018"
rust-version = "1.34"
rust-version = "1.34" # Prevent clippy from suggesting a code that requires a new version.
publish = false

[lib]
Expand Down
5 changes: 0 additions & 5 deletions tests/api-test/build.rs

This file was deleted.

6 changes: 5 additions & 1 deletion tests/avr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ resolver = "2"
[lints.rust]
rust_2018_idioms = "warn"
single_use_lifetimes = "warn"
unexpected_cfgs = { level = "warn", check-cfg = [
"cfg(target_arch,values(\"xtensa\"))",
"cfg(qemu)",
] }
# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV
[lints.clippy]
lint_groups_priority = { level = "allow", priority = 1 } # clippy bug: https://github.com/rust-lang/rust-clippy/issues/12270
lint_groups_priority = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/12270

[profile.dev]
lto = true
Expand Down
6 changes: 0 additions & 6 deletions tests/avr/build.rs

This file was deleted.

5 changes: 4 additions & 1 deletion tests/gba/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ resolver = "2"
[lints.rust]
rust_2018_idioms = "warn"
single_use_lifetimes = "warn"
unexpected_cfgs = { level = "warn", check-cfg = [
"cfg(target_arch,values(\"xtensa\"))",
] }
# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV
[lints.clippy]
lint_groups_priority = { level = "allow", priority = 1 } # clippy bug: https://github.com/rust-lang/rust-clippy/issues/12270
lint_groups_priority = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/12270

[profile.dev]
# TODO: "GBA: Illegal opcode: e7ffdefe" on opt-level=0, GBA hang on opt-level={1,s,z}
Expand Down
5 changes: 0 additions & 5 deletions tests/gba/build.rs

This file was deleted.

2 changes: 1 addition & 1 deletion tests/helper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "test-helper"
version = "0.0.0"
edition = "2018"
rust-version = "1.34"
rust-version = "1.34" # Prevent clippy from suggesting a code that requires a new version.
publish = false

[lib]
Expand Down
1 change: 0 additions & 1 deletion tests/helper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#![no_std]
#![allow(
clippy::incompatible_msrv,
clippy::missing_panics_doc,
clippy::new_without_default,
clippy::undocumented_unsafe_blocks
Expand Down
5 changes: 4 additions & 1 deletion tests/no-std-qemu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ resolver = "2"
[lints.rust]
rust_2018_idioms = "warn"
single_use_lifetimes = "warn"
unexpected_cfgs = { level = "warn", check-cfg = [
"cfg(target_arch,values(\"xtensa\"))",
] }
# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV
[lints.clippy]
lint_groups_priority = { level = "allow", priority = 1 } # clippy bug: https://github.com/rust-lang/rust-clippy/issues/12270
lint_groups_priority = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/12270
single_match = { level = "allow", priority = 1 }

[profile.dev]
Expand Down
1 change: 0 additions & 1 deletion tests/no-std-qemu/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::env;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rustc-check-cfg=cfg(armv5te,f,d)");
println!(r#"cargo:rustc-check-cfg=cfg(target_arch,values("xtensa"))"#); // for helper.rs

let target = &*env::var("TARGET").expect("TARGET not set");
let target_arch = &*env::var("CARGO_CFG_TARGET_ARCH").expect("CARGO_CFG_TARGET_ARCH not set");
Expand Down
5 changes: 4 additions & 1 deletion tests/xtensa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ resolver = "2"
[lints.rust]
rust_2018_idioms = "warn"
single_use_lifetimes = "warn"
unexpected_cfgs = { level = "warn", check-cfg = [
"cfg(target_arch,values(\"xtensa\"))",
] }
# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV
[lints.clippy]
lint_groups_priority = { level = "allow", priority = 1 } # clippy bug: https://github.com/rust-lang/rust-clippy/issues/12270
lint_groups_priority = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/12270

[profile.dev]
opt-level = 'z'
Expand Down
5 changes: 0 additions & 5 deletions tests/xtensa/build.rs

This file was deleted.

0 comments on commit 861ad6f

Please sign in to comment.