From b6d3a4093e33867c0f56829d76b9f2a46faed85d Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 21 Sep 2023 23:55:44 +0900 Subject: [PATCH] Apply more clippy restriction lint --- portable-atomic-util/src/lib.rs | 24 +++++++++++++----------- src/lib.rs | 26 +++++++++++++------------- tools/codegen/src/ffi.rs | 2 +- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/portable-atomic-util/src/lib.rs b/portable-atomic-util/src/lib.rs index 560517bc..8468f324 100644 --- a/portable-atomic-util/src/lib.rs +++ b/portable-atomic-util/src/lib.rs @@ -45,31 +45,33 @@ See [#1] for other primitives being considered for addition to this crate. ) ))] #![warn( - missing_debug_implementations, - missing_docs, rust_2018_idioms, single_use_lifetimes, - unreachable_pub -)] -#![cfg_attr(not(portable_atomic_no_unsafe_op_in_unsafe_fn), warn(unsafe_op_in_unsafe_fn))] // unsafe_op_in_unsafe_fn requires Rust 1.52 -#![cfg_attr(portable_atomic_no_unsafe_op_in_unsafe_fn, allow(unused_unsafe))] -#![warn( + unreachable_pub, clippy::pedantic, - // lints for public library + // Lints that may help when writing public library. + missing_debug_implementations, + missing_docs, clippy::alloc_instead_of_core, clippy::exhaustive_enums, clippy::exhaustive_structs, + clippy::impl_trait_in_params, + // clippy::missing_inline_in_public_items, clippy::std_instead_of_alloc, clippy::std_instead_of_core, - // lints that help writing unsafe code + // Lints that may help when writing unsafe code. + improper_ctypes, + improper_ctypes_definitions, + // unsafe_op_in_unsafe_fn, // set conditionally since it requires Rust 1.52 clippy::as_ptr_cast_mut, clippy::default_union_representation, + clippy::inline_asm_x86_att_syntax, clippy::trailing_empty_array, clippy::transmute_undefined_repr, clippy::undocumented_unsafe_blocks, - // misc - clippy::inline_asm_x86_att_syntax, )] +#![cfg_attr(not(portable_atomic_no_unsafe_op_in_unsafe_fn), warn(unsafe_op_in_unsafe_fn))] // unsafe_op_in_unsafe_fn requires Rust 1.52 +#![cfg_attr(portable_atomic_no_unsafe_op_in_unsafe_fn, allow(unused_unsafe))] #![allow( clippy::cast_lossless, clippy::doc_markdown, diff --git a/src/lib.rs b/src/lib.rs index 115b682e..78def9e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -196,33 +196,33 @@ RUSTFLAGS="--cfg portable_atomic_no_outline_atomics" cargo ... ) ))] #![warn( - improper_ctypes, - missing_debug_implementations, - missing_docs, rust_2018_idioms, single_use_lifetimes, - unreachable_pub -)] -#![cfg_attr(not(portable_atomic_no_unsafe_op_in_unsafe_fn), warn(unsafe_op_in_unsafe_fn))] // unsafe_op_in_unsafe_fn requires Rust 1.52 -#![cfg_attr(portable_atomic_no_unsafe_op_in_unsafe_fn, allow(unused_unsafe))] -#![warn( + unreachable_pub, clippy::pedantic, - // lints for public library + // Lints that may help when writing public library. + missing_debug_implementations, + missing_docs, clippy::alloc_instead_of_core, clippy::exhaustive_enums, clippy::exhaustive_structs, + clippy::impl_trait_in_params, + clippy::missing_inline_in_public_items, clippy::std_instead_of_alloc, clippy::std_instead_of_core, - // lints that help writing unsafe code + // Lints that may help when writing unsafe code. + improper_ctypes, + improper_ctypes_definitions, + // unsafe_op_in_unsafe_fn, // set conditionally since it requires Rust 1.52 clippy::as_ptr_cast_mut, clippy::default_union_representation, + clippy::inline_asm_x86_att_syntax, clippy::trailing_empty_array, clippy::transmute_undefined_repr, clippy::undocumented_unsafe_blocks, - // misc - clippy::inline_asm_x86_att_syntax, - clippy::missing_inline_in_public_items, )] +#![cfg_attr(not(portable_atomic_no_unsafe_op_in_unsafe_fn), warn(unsafe_op_in_unsafe_fn))] // unsafe_op_in_unsafe_fn requires Rust 1.52 +#![cfg_attr(portable_atomic_no_unsafe_op_in_unsafe_fn, allow(unused_unsafe))] #![allow( clippy::cast_lossless, clippy::doc_markdown, diff --git a/tools/codegen/src/ffi.rs b/tools/codegen/src/ffi.rs index 501909eb..a6a3725e 100644 --- a/tools/codegen/src/ffi.rs +++ b/tools/codegen/src/ffi.rs @@ -494,7 +494,7 @@ pub(crate) fn gen() -> Result<()> { src_dir.join("include"), src_dir.join("include/sys"), src_dir.join("lib/libpthread"), - ] + ]; } fuchsia => { header_path = src_dir.join(header.path);