Skip to content

Commit c1f5b6b

Browse files
committed
Fix clippy lints
1 parent f8d9375 commit c1f5b6b

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

src/aarch64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,5 +302,5 @@ mod tests {
302302
}
303303
}
304304

305-
crate::generate_tests!(neon_searcher, NeonSearcher);
305+
crate::tests::generate_tests!(neon_searcher, NeonSearcher);
306306
}

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ trait Searcher<N: NeedleWithSize + ?Sized> {
293293
}
294294

295295
#[cfg(test)]
296-
mod tests {
296+
pub(crate) mod tests {
297297
use super::{MemchrSearcher, Needle};
298298

299299
fn memchr_search(haystack: &[u8], needle: &[u8]) -> bool {
@@ -380,7 +380,6 @@ mod tests {
380380
result
381381
}
382382

383-
#[macro_export]
384383
macro_rules! generate_tests {
385384
($mod: ident, $name:ident) => {
386385
mod $mod {
@@ -418,6 +417,7 @@ mod tests {
418417
}
419418
};
420419
}
420+
pub(crate) use generate_tests;
421421

422422
pub(crate) fn search_same<S: TestSearcher>() {
423423
assert!(search::<S>(b"x", b"x"));

src/stdsimd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,5 +193,5 @@ mod tests {
193193
}
194194
}
195195

196-
crate::generate_tests!(std_simd_searcher, StdSimdSearcher);
196+
crate::tests::generate_tests!(std_simd_searcher, StdSimdSearcher);
197197
}

src/wasm32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,5 +289,5 @@ mod tests {
289289
}
290290
}
291291

292-
crate::generate_tests!(wasm32_searcher, Wasm32Searcher);
292+
crate::tests::generate_tests!(wasm32_searcher, Wasm32Searcher);
293293
}

src/x86.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl Vector for __m16i {
5959
#[inline]
6060
#[target_feature(enable = "avx2")]
6161
unsafe fn to_bitmask(a: Self) -> u32 {
62-
std::mem::transmute(_mm_movemask_epi8(a.0) & 0x3)
62+
i32::cast_unsigned(_mm_movemask_epi8(a.0) & 0x3)
6363
}
6464
}
6565

@@ -106,7 +106,7 @@ impl Vector for __m32i {
106106
#[inline]
107107
#[target_feature(enable = "avx2")]
108108
unsafe fn to_bitmask(a: Self) -> u32 {
109-
std::mem::transmute(_mm_movemask_epi8(a.0) & 0xF)
109+
i32::cast_unsigned(_mm_movemask_epi8(a.0) & 0xF)
110110
}
111111
}
112112

@@ -153,7 +153,7 @@ impl Vector for __m64i {
153153
#[inline]
154154
#[target_feature(enable = "avx2")]
155155
unsafe fn to_bitmask(a: Self) -> u32 {
156-
std::mem::transmute(_mm_movemask_epi8(a.0) & 0xFF)
156+
i32::cast_unsigned(_mm_movemask_epi8(a.0) & 0xFF)
157157
}
158158
}
159159

@@ -195,7 +195,7 @@ impl Vector for __m128i {
195195
#[inline]
196196
#[target_feature(enable = "avx2")]
197197
unsafe fn to_bitmask(a: Self) -> u32 {
198-
std::mem::transmute(_mm_movemask_epi8(a))
198+
i32::cast_unsigned(_mm_movemask_epi8(a))
199199
}
200200
}
201201

@@ -230,7 +230,7 @@ impl Vector for __m256i {
230230
#[inline]
231231
#[target_feature(enable = "avx2")]
232232
unsafe fn to_bitmask(a: Self) -> u32 {
233-
std::mem::transmute(_mm256_movemask_epi8(a))
233+
i32::cast_unsigned(_mm256_movemask_epi8(a))
234234
}
235235
}
236236

@@ -587,7 +587,7 @@ mod tests {
587587
}
588588

589589
impl crate::tests::TestSearcher for Avx2Searcher<&[u8]> {
590-
fn with_position(needle: &'static [u8], position: usize) -> Avx2Searcher<&[u8]> {
590+
fn with_position(needle: &'static [u8], position: usize) -> Avx2Searcher<&'static [u8]> {
591591
unsafe { Avx2Searcher::with_position(needle, position) }
592592
}
593593

@@ -596,10 +596,10 @@ mod tests {
596596
}
597597
}
598598

599-
crate::generate_tests!(avx2_searcher, Avx2Searcher);
599+
crate::tests::generate_tests!(avx2_searcher, Avx2Searcher);
600600

601601
impl crate::tests::TestSearcher for DynamicAvx2Searcher<&[u8]> {
602-
fn with_position(needle: &'static [u8], position: usize) -> DynamicAvx2Searcher<&[u8]> {
602+
fn with_position(needle: &'static [u8], position: usize) -> DynamicAvx2Searcher<&'static [u8]> {
603603
unsafe { DynamicAvx2Searcher::with_position(needle, position) }
604604
}
605605

@@ -608,5 +608,5 @@ mod tests {
608608
}
609609
}
610610

611-
crate::generate_tests!(dynamic_avx2_searcher, DynamicAvx2Searcher);
611+
crate::tests::generate_tests!(dynamic_avx2_searcher, DynamicAvx2Searcher);
612612
}

0 commit comments

Comments
 (0)