Skip to content

Commit 46582df

Browse files
committed
Do not use Self constructors
1 parent 52d382f commit 46582df

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

crates/core_arch/src/simd.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ macro_rules! simd_ty {
99
#[derive(Copy, Clone, Debug, PartialEq)]
1010
pub(crate) struct $id($(pub $elem_ty),*);
1111

12+
#[cfg_attr(feature = "cargo-clippy", allow(clippy::use_self))]
1213
impl $id {
1314
#[inline]
1415
pub(crate) const fn new($($elem_name: $elem_ty),*) -> Self {
15-
Self($($elem_name),*)
16+
$id($($elem_name),*)
1617
}
1718

1819
#[inline]
1920
pub(crate) const fn splat(value: $ety) -> Self {
20-
Self($({
21+
$id($({
2122
#[allow(non_camel_case_types, dead_code)]
2223
struct $elem_name;
2324
value
@@ -40,6 +41,7 @@ macro_rules! simd_m_ty {
4041
#[derive(Copy, Clone, Debug, PartialEq)]
4142
pub(crate) struct $id($(pub $elem_ty),*);
4243

44+
#[cfg_attr(feature = "cargo-clippy", allow(clippy::use_self))]
4345
impl $id {
4446
#[inline]
4547
const fn bool_to_internal(x: bool) -> $ety {
@@ -48,12 +50,12 @@ macro_rules! simd_m_ty {
4850

4951
#[inline]
5052
pub(crate) const fn new($($elem_name: bool),*) -> Self {
51-
Self($(Self::bool_to_internal($elem_name)),*)
53+
$id($(Self::bool_to_internal($elem_name)),*)
5254
}
5355

5456
#[inline]
5557
pub(crate) const fn splat(value: bool) -> Self {
56-
Self($({
58+
$id($({
5759
#[allow(non_camel_case_types, dead_code)]
5860
struct $elem_name;
5961
Self::bool_to_internal(value)

crates/std_detect/src/detect/cache.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ const CACHE_CAPACITY: u32 = 63;
3030
#[derive(Copy, Clone)]
3131
pub(crate) struct Initializer(u64);
3232

33+
#[cfg_attr(feature = "cargo-clippy", allow(clippy::use_self))]
3334
impl Default for Initializer {
3435
fn default() -> Self {
35-
Self(0)
36+
Initializer(0)
3637
}
3738
}
3839

@@ -75,6 +76,7 @@ static CACHE: Cache = Cache::uninitialized();
7576
struct Cache(AtomicU64);
7677

7778
#[cfg(target_pointer_width = "64")]
79+
#[cfg_attr(feature = "cargo-clippy", allow(clippy::use_self))]
7880
impl Cache {
7981
/// Creates an uninitialized cache.
8082
#[cfg_attr(
@@ -83,7 +85,7 @@ impl Cache {
8385
)]
8486
const fn uninitialized() -> Self {
8587
const X: AtomicU64 = AtomicU64::new(u64::max_value());
86-
Self(X)
88+
Cache(X)
8789
}
8890
/// Is the cache uninitialized?
8991
#[inline]

0 commit comments

Comments
 (0)