Skip to content

Commit

Permalink
Apply unqualified_local_imports lint
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Nov 21, 2024
1 parent 6cb9820 commit bf45583
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion bench/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ mod intrinsics;
#[path = "../../src/imp/fallback/mod.rs"]
mod seqlock_fallback;
#[allow(unused_imports)]
use seqlock_fallback as fallback;
use self::seqlock_fallback as fallback;
#[allow(dead_code, unused_imports)]
#[path = "imp/spinlock_fallback.rs"]
mod spinlock_fallback;
Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#[path = "version.rs"]
mod version;
use version::{rustc_version, Version};
use self::version::{rustc_version, Version};

use std::{env, str};

Expand Down
2 changes: 1 addition & 1 deletion portable-atomic-util/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#[allow(dead_code)]
#[path = "version.rs"]
mod version;
use version::{rustc_version, Version};
use self::version::{rustc_version, Version};

use std::env;

Expand Down
2 changes: 1 addition & 1 deletion portable-atomic-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ extern crate std as alloc;
#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "std"))))]
mod arc;
#[cfg(any(all(feature = "alloc", not(portable_atomic_no_alloc)), feature = "std"))]
pub use arc::{Arc, Weak};
pub use self::arc::{Arc, Weak};

#[cfg(not(portable_atomic_no_futures_api))]
#[cfg(any(all(feature = "alloc", not(portable_atomic_no_alloc)), feature = "std"))]
Expand Down
2 changes: 1 addition & 1 deletion src/cfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ mod check {
crate::cfg_has_atomic_cas! { type __AtomicPtr = (); }
crate::cfg_no_atomic_cas! { type __AtomicPtr = (); }
#[allow(unused_imports)]
use {
use self::{
_Atomic128 as _, _Atomic16 as _, _Atomic32 as _, _Atomic64 as _, _Atomic8 as _,
_AtomicPtr as _, __AtomicPtr as _,
};
Expand Down
4 changes: 2 additions & 2 deletions src/imp/detect/auxv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ so we use it (see aarch64_aa64reg.rs).

include!("common.rs");

use os::ffi;
use self::os::ffi;
#[cfg(any(target_os = "linux", target_os = "android"))]
mod os {
// core::ffi::c_* (except c_void) requires Rust 1.64, libc requires Rust 1.63
Expand Down Expand Up @@ -409,7 +409,7 @@ mod os {

// Basically, Linux/FreeBSD/OpenBSD use the same hwcap values.
// FreeBSD and OpenBSD usually support a subset of the hwcap values supported by Linux.
use arch::_detect;
use self::arch::_detect;
#[cfg(target_arch = "aarch64")]
mod arch {
use super::{ffi, os, CpuInfo};
Expand Down
8 changes: 5 additions & 3 deletions src/imp/fallback/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,15 @@ cfg_no_fast_atomic_64! {

use core::{cell::UnsafeCell, mem, sync::atomic::Ordering};

use seq_lock::{SeqLock, SeqLockWriteGuard};
use utils::CachePadded;
use self::{
seq_lock::{SeqLock, SeqLockWriteGuard},
utils::CachePadded,
};

// 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,
// so use it to reduce chunks of byte-wise atomic memcpy.
use seq_lock::{AtomicChunk, Chunk};
use self::seq_lock::{AtomicChunk, Chunk};

// Adapted from https://github.com/crossbeam-rs/crossbeam/blob/crossbeam-utils-0.8.7/crossbeam-utils/src/atomic/atomic_cell.rs#L969-L1016.
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/imp/interrupt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ See also README.md of this directory.
// called while interrupts are disabled, and since the load/store is
// atomic, it is not affected by interrupts even if interrupts are enabled.
#[cfg(not(any(target_arch = "avr", feature = "critical-section")))]
use arch::atomic;
use self::arch::atomic;

#[cfg(not(feature = "critical-section"))]
#[cfg_attr(
Expand Down
22 changes: 11 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,13 @@ extern crate std;
#[macro_use]
mod cfgs;
#[cfg(target_pointer_width = "128")]
pub use {cfg_has_atomic_128 as cfg_has_atomic_ptr, cfg_no_atomic_128 as cfg_no_atomic_ptr};
pub use self::{cfg_has_atomic_128 as cfg_has_atomic_ptr, cfg_no_atomic_128 as cfg_no_atomic_ptr};
#[cfg(target_pointer_width = "16")]
pub use {cfg_has_atomic_16 as cfg_has_atomic_ptr, cfg_no_atomic_16 as cfg_no_atomic_ptr};
pub use self::{cfg_has_atomic_16 as cfg_has_atomic_ptr, cfg_no_atomic_16 as cfg_no_atomic_ptr};
#[cfg(target_pointer_width = "32")]
pub use {cfg_has_atomic_32 as cfg_has_atomic_ptr, cfg_no_atomic_32 as cfg_no_atomic_ptr};
pub use self::{cfg_has_atomic_32 as cfg_has_atomic_ptr, cfg_no_atomic_32 as cfg_no_atomic_ptr};
#[cfg(target_pointer_width = "64")]
pub use {cfg_has_atomic_64 as cfg_has_atomic_ptr, cfg_no_atomic_64 as cfg_no_atomic_ptr};
pub use self::{cfg_has_atomic_64 as cfg_has_atomic_ptr, cfg_no_atomic_64 as cfg_no_atomic_ptr};

#[macro_use]
mod utils;
Expand All @@ -470,12 +470,12 @@ mod tests;
#[doc(no_inline)]
pub use core::sync::atomic::Ordering;

#[doc(no_inline)]
// LLVM doesn't support fence/compiler_fence for MSP430.
#[cfg(target_arch = "msp430")]
pub use self::imp::msp430::{compiler_fence, fence};
#[doc(no_inline)]
#[cfg(not(target_arch = "msp430"))]
pub use core::sync::atomic::{compiler_fence, fence};
#[cfg(target_arch = "msp430")]
pub use imp::msp430::{compiler_fence, fence};

mod imp;

Expand Down Expand Up @@ -4768,17 +4768,17 @@ cfg_has_atomic_128! {
cfg_no_atomic_cas! {
cfg_no_atomic_cas_or_amo32! {
#[cfg(feature = "float")]
use diagnostic_helper::HasFetchAbs;
use diagnostic_helper::{
use self::diagnostic_helper::HasFetchAbs;
use self::diagnostic_helper::{
HasAnd, HasBitClear, HasBitSet, HasBitToggle, HasFetchAnd, HasFetchByteAdd, HasFetchByteSub,
HasFetchNot, HasFetchOr, HasFetchPtrAdd, HasFetchPtrSub, HasFetchXor, HasNot, HasOr, HasXor,
};
} // cfg_no_atomic_cas_or_amo32!
cfg_no_atomic_cas_or_amo8! {
use diagnostic_helper::{HasAdd, HasSub, HasSwap};
use self::diagnostic_helper::{HasAdd, HasSub, HasSwap};
} // cfg_no_atomic_cas_or_amo8!
#[cfg_attr(not(feature = "float"), allow(unused_imports))]
use diagnostic_helper::{
use self::diagnostic_helper::{
HasCompareExchange, HasCompareExchangeWeak, HasFetchAdd, HasFetchMax, HasFetchMin,
HasFetchNand, HasFetchNeg, HasFetchSub, HasFetchUpdate, HasNeg,
};
Expand Down
2 changes: 1 addition & 1 deletion src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ fn test_is_lock_free() {
// test version parsing code used in the build script.
#[test]
fn test_rustc_version() {
use version::Version;
use self::version::Version;

// rustc 1.34 (rustup)
let v = Version::parse(
Expand Down
4 changes: 3 additions & 1 deletion tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ else
base_args=(hack "${subcmd}")
fi
nightly=''
base_rustflags="${RUSTFLAGS:-}"
if [[ "${rustc_version}" =~ nightly|dev ]]; then
nightly=1
if [[ -z "${is_custom_toolchain}" ]]; then
Expand All @@ -246,6 +247,7 @@ if [[ "${rustc_version}" =~ nightly|dev ]]; then
subcmd=clippy
retry rustup ${pre_args[@]+"${pre_args[@]}"} component add clippy &>/dev/null
base_args=(hack "${subcmd}")
base_rustflags+=' -Z crate-attr=feature(unqualified_local_imports) -W unqualified_local_imports'
fi
fi
export CARGO_TARGET_DIR="${target_dir}"
Expand All @@ -262,7 +264,7 @@ build() {
local target="$1"
shift
local args=("${base_args[@]}")
local target_rustflags="${RUSTFLAGS:-}"
local target_rustflags="${base_rustflags}"
if ! grep -Eq "^${target}$" <<<"${rustc_target_list}" || [[ -f "target-specs/${target}.json" ]]; then
if [[ ! -f "target-specs/${target}.json" ]]; then
printf '%s\n' "target '${target}' not available on ${rustc_version} (skipped all checks)"
Expand Down

0 comments on commit bf45583

Please sign in to comment.