Skip to content

Commit

Permalink
Apply clippy::unused_trait_names lint
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jan 13, 2025
1 parent 5a9e74b commit b7a49d3
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 20 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ inline_asm_x86_att_syntax = "warn"
trailing_empty_array = "warn"
transmute_undefined_repr = "warn"
undocumented_unsafe_blocks = "warn"
unused_trait_names = "warn"
# Suppress buggy or noisy clippy lints
bool_assert_comparison = { level = "allow", priority = 1 }
borrow_as_ptr = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/8286
Expand Down
2 changes: 1 addition & 1 deletion bench/benches/imp/spinlock_fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use core::{

use super::fallback::utils::{Backoff, CachePadded};
#[cfg(portable_atomic_no_strict_provenance)]
use crate::utils::ptr::PtrExt;
use crate::utils::ptr::PtrExt as _;

struct Spinlock {
state: AtomicUsize,
Expand Down
2 changes: 1 addition & 1 deletion portable-atomic-util/src/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3129,7 +3129,7 @@ impl Global {
}

#[cfg(portable_atomic_no_strict_provenance)]
use self::strict::PtrExt;
use self::strict::PtrExt as _;

// strict_provenance polyfill for pre-1.84 rustc.
mod strict {
Expand Down
2 changes: 1 addition & 1 deletion portable-atomic-util/tests/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn is_panic_abort() -> bool {
#[allow(clippy::many_single_char_names)]
mod alloc_tests {
use std::{
convert::TryInto,
convert::TryInto as _,
sync::{mpsc::channel, Mutex},
thread,
};
Expand Down
2 changes: 1 addition & 1 deletion src/imp/detect/aarch64_aa64reg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ mod imp {
mod tests {
use std::{
process::Command,
string::{String, ToString},
string::{String, ToString as _},
};

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion src/imp/detect/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ mod tests_common {
fn print_features() {
use std::{
fmt::Write as _,
io::{self, Write},
io::{self, Write as _},
string::String,
};

Expand Down
2 changes: 1 addition & 1 deletion src/imp/detect/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn _detect(info: &mut CpuInfo) {
#[cfg(test)]
mod tests {
use std::{
io::{self, Write},
io::{self, Write as _},
mem, str,
};

Expand Down
2 changes: 1 addition & 1 deletion src/imp/fallback/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ use self::{
utils::CachePadded,
};
#[cfg(portable_atomic_no_strict_provenance)]
use crate::utils::ptr::PtrExt;
use crate::utils::ptr::PtrExt as _;

// Some 64-bit architectures have ABI with 32-bit pointer width (e.g., x86_64 X32 ABI,
// AArch64 ILP32 ABI, mips64 N32 ABI). On those targets, AtomicU64 is fast,
Expand Down
22 changes: 11 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ RUSTFLAGS="--cfg portable_atomic_no_outline_atomics" cargo ...
feature = "critical-section",
)),
),
allow(unused_imports, unused_macros)
allow(unused_imports, unused_macros, clippy::unused_trait_names)
)]

// There are currently no 128-bit or higher builtin targets.
Expand Down Expand Up @@ -538,7 +538,7 @@ use core::{fmt, ptr};

#[cfg(portable_atomic_no_strict_provenance)]
#[cfg(miri)]
use crate::utils::ptr::PtrExt;
use crate::utils::ptr::PtrExt as _;

cfg_has_atomic_8! {
/// A boolean type which can be safely shared between threads.
Expand Down Expand Up @@ -2060,7 +2060,7 @@ impl<T> AtomicPtr<T> {
///
/// ```
/// # #![allow(unstable_name_collisions)]
/// # #[allow(unused_imports)] use sptr::Strict; // strict provenance polyfill for old rustc
/// # #[allow(unused_imports)] use sptr::Strict as _; // strict provenance polyfill for old rustc
/// use portable_atomic::{AtomicPtr, Ordering};
///
/// let atom = AtomicPtr::<i64>::new(core::ptr::null_mut());
Expand Down Expand Up @@ -2128,7 +2128,7 @@ impl<T> AtomicPtr<T> {
///
/// ```
/// # #![allow(unstable_name_collisions)]
/// # #[allow(unused_imports)] use sptr::Strict; // strict provenance polyfill for old rustc
/// # #[allow(unused_imports)] use sptr::Strict as _; // strict provenance polyfill for old rustc
/// use portable_atomic::{AtomicPtr, Ordering};
///
/// let atom = AtomicPtr::<i64>::new(core::ptr::null_mut());
Expand Down Expand Up @@ -2175,7 +2175,7 @@ impl<T> AtomicPtr<T> {
///
/// ```
/// # #![allow(unstable_name_collisions)]
/// # #[allow(unused_imports)] use sptr::Strict; // strict provenance polyfill for old rustc
/// # #[allow(unused_imports)] use sptr::Strict as _; // strict provenance polyfill for old rustc
/// use portable_atomic::{AtomicPtr, Ordering};
///
/// let atom = AtomicPtr::<i64>::new(sptr::invalid_mut(1));
Expand Down Expand Up @@ -2230,7 +2230,7 @@ impl<T> AtomicPtr<T> {
///
/// ```
/// # #![allow(unstable_name_collisions)]
/// # #[allow(unused_imports)] use sptr::Strict; // strict provenance polyfill for old rustc
/// # #[allow(unused_imports)] use sptr::Strict as _; // strict provenance polyfill for old rustc
/// use portable_atomic::{AtomicPtr, Ordering};
///
/// let pointer = &mut 3i64 as *mut i64;
Expand Down Expand Up @@ -2291,7 +2291,7 @@ impl<T> AtomicPtr<T> {
///
/// ```
/// # #![allow(unstable_name_collisions)]
/// # #[allow(unused_imports)] use sptr::Strict; // strict provenance polyfill for old rustc
/// # #[allow(unused_imports)] use sptr::Strict as _; // strict provenance polyfill for old rustc
/// use portable_atomic::{AtomicPtr, Ordering};
///
/// let pointer = &mut 3i64 as *mut i64;
Expand Down Expand Up @@ -2350,7 +2350,7 @@ impl<T> AtomicPtr<T> {
///
/// ```
/// # #![allow(unstable_name_collisions)]
/// # #[allow(unused_imports)] use sptr::Strict; // strict provenance polyfill for old rustc
/// # #[allow(unused_imports)] use sptr::Strict as _; // strict provenance polyfill for old rustc
/// use portable_atomic::{AtomicPtr, Ordering};
///
/// let pointer = &mut 3i64 as *mut i64;
Expand Down Expand Up @@ -2396,7 +2396,7 @@ impl<T> AtomicPtr<T> {
///
/// ```
/// # #![allow(unstable_name_collisions)]
/// # #[allow(unused_imports)] use sptr::Strict; // strict provenance polyfill for old rustc
/// # #[allow(unused_imports)] use sptr::Strict as _; // strict provenance polyfill for old rustc
/// use portable_atomic::{AtomicPtr, Ordering};
///
/// let pointer = &mut 3i64 as *mut i64;
Expand Down Expand Up @@ -2444,7 +2444,7 @@ impl<T> AtomicPtr<T> {
///
/// ```
/// # #![allow(unstable_name_collisions)]
/// # #[allow(unused_imports)] use sptr::Strict; // strict provenance polyfill for old rustc
/// # #[allow(unused_imports)] use sptr::Strict as _; // strict provenance polyfill for old rustc
/// use portable_atomic::{AtomicPtr, Ordering};
///
/// let pointer = &mut 3i64 as *mut i64;
Expand Down Expand Up @@ -2489,7 +2489,7 @@ impl<T> AtomicPtr<T> {
///
/// ```
/// # #![allow(unstable_name_collisions)]
/// # #[allow(unused_imports)] use sptr::Strict; // strict provenance polyfill for old rustc
/// # #[allow(unused_imports)] use sptr::Strict as _; // strict provenance polyfill for old rustc
/// use portable_atomic::{AtomicPtr, Ordering};
///
/// let pointer = &mut 3i64 as *mut i64;
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ macro_rules! __test_atomic_ptr_pub {
($atomic_type:ty) => {
__test_atomic_pub_common!($atomic_type, *mut u8);
#[allow(unused_imports)]
use sptr::Strict; // for old rustc
use sptr::Strict as _; // for old rustc
use std::{boxed::Box, mem};
#[test]
fn fetch_update() {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ type RetInt = u32;
#[inline]
pub(crate) fn create_sub_word_mask_values<T>(ptr: *mut T) -> (*mut MinWord, RetInt, RetInt) {
#[cfg(portable_atomic_no_strict_provenance)]
use self::ptr::PtrExt;
use self::ptr::PtrExt as _;
use core::mem;
// RISC-V, MIPS, SPARC, LoongArch, Xtensa, BPF: shift amount of 32-bit shift instructions is 5 bits unsigned (0-31).
// PowerPC, C-SKY: shift amount of 32-bit shift instructions is 6 bits unsigned (0-63) and shift amount 32-63 means "clear".
Expand Down

0 comments on commit b7a49d3

Please sign in to comment.