Skip to content

Commit

Permalink
Apply more clippy restriction/pedantic lints
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Sep 23, 2023
1 parent ac7e870 commit ea83130
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 28 deletions.
5 changes: 3 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

// The rustc-cfg emitted by the build script are *not* public API.

#![warn(rust_2018_idioms, single_use_lifetimes)]
#![warn(rust_2018_idioms, single_use_lifetimes, clippy::pedantic)]
#![allow(clippy::match_same_arms, clippy::single_match_else, clippy::too_many_lines)]

#[path = "version.rs"]
mod version;
Expand Down Expand Up @@ -255,7 +256,7 @@ fn main() {
// arm-linux-androideabi is v5te
// https://github.com/rust-lang/rust/blob/1.70.0/compiler/rustc_target/src/spec/arm_linux_androideabi.rs#L11-L12
_ if target == "arm-linux-androideabi" => subarch = "v5te",
// armeb-unknown-linux-gnueabi is v8
// armeb-unknown-linux-gnueabi is v8 & aclass
// https://github.com/rust-lang/rust/blob/1.70.0/compiler/rustc_target/src/spec/armeb_unknown_linux_gnueabi.rs#L12
_ if target == "armeb-unknown-linux-gnueabi" => subarch = "v8",
// v6 targets other than v6m don't have *class target feature.
Expand Down
3 changes: 2 additions & 1 deletion portable-atomic-util/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

// The rustc-cfg emitted by the build script are *not* public API.

#![warn(rust_2018_idioms, single_use_lifetimes)]
#![warn(rust_2018_idioms, single_use_lifetimes, clippy::pedantic)]
#![allow(clippy::single_match_else, clippy::too_many_lines)]

// version.rs is shared with portable-atomic's build script, and portable-atomic-util only uses a part of it.
#[allow(dead_code)]
Expand Down
24 changes: 13 additions & 11 deletions portable-atomic-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, // requires Rust 1.46
// 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,
Expand Down
26 changes: 13 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, // requires Rust 1.46
// 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,
Expand Down
2 changes: 1 addition & 1 deletion tools/codegen/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ea83130

Please sign in to comment.