Skip to content

Commit 2d13059

Browse files
Clean up use of cargo feature "std"
1 parent 2e5e0ec commit 2d13059

File tree

5 files changed

+22
-43
lines changed

5 files changed

+22
-43
lines changed

crates/core_simd/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![cfg_attr(not(feature = "std"), no_std)]
1+
#![no_std]
22
#![feature(
33
convert_float_to_int,
44
decl_macro,

crates/core_simd/src/math.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ macro_rules! impl_uint_arith {
1010
/// # Examples
1111
/// ```
1212
/// # #![feature(portable_simd)]
13-
/// # #[cfg(feature = "std")] use core_simd::Simd;
14-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
13+
/// # use core::simd::Simd;
1514
#[doc = concat!("# use core::", stringify!($ty), "::MAX;")]
1615
/// let x = Simd::from_array([2, 1, 0, MAX]);
1716
/// let max = Simd::splat(MAX);
@@ -31,8 +30,7 @@ macro_rules! impl_uint_arith {
3130
/// # Examples
3231
/// ```
3332
/// # #![feature(portable_simd)]
34-
/// # #[cfg(feature = "std")] use core_simd::Simd;
35-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
33+
/// # use core::simd::Simd;
3634
#[doc = concat!("# use core::", stringify!($ty), "::MAX;")]
3735
/// let x = Simd::from_array([2, 1, 0, MAX]);
3836
/// let max = Simd::splat(MAX);
@@ -58,8 +56,7 @@ macro_rules! impl_int_arith {
5856
/// # Examples
5957
/// ```
6058
/// # #![feature(portable_simd)]
61-
/// # #[cfg(feature = "std")] use core_simd::Simd;
62-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
59+
/// # use core::simd::Simd;
6360
#[doc = concat!("# use core::", stringify!($ty), "::{MIN, MAX};")]
6461
/// let x = Simd::from_array([MIN, 0, 1, MAX]);
6562
/// let max = Simd::splat(MAX);
@@ -79,8 +76,7 @@ macro_rules! impl_int_arith {
7976
/// # Examples
8077
/// ```
8178
/// # #![feature(portable_simd)]
82-
/// # #[cfg(feature = "std")] use core_simd::Simd;
83-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
79+
/// # use core::simd::Simd;
8480
#[doc = concat!("# use core::", stringify!($ty), "::{MIN, MAX};")]
8581
/// let x = Simd::from_array([MIN, -2, -1, MAX]);
8682
/// let max = Simd::splat(MAX);
@@ -100,8 +96,7 @@ macro_rules! impl_int_arith {
10096
/// # Examples
10197
/// ```
10298
/// # #![feature(portable_simd)]
103-
/// # #[cfg(feature = "std")] use core_simd::Simd;
104-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
99+
/// # use core::simd::Simd;
105100
#[doc = concat!("# use core::", stringify!($ty), "::{MIN, MAX};")]
106101
/// let xs = Simd::from_array([MIN, MIN +1, -5, 0]);
107102
/// assert_eq!(xs.abs(), Simd::from_array([MIN, MAX, 5, 0]));
@@ -119,8 +114,7 @@ macro_rules! impl_int_arith {
119114
/// # Examples
120115
/// ```
121116
/// # #![feature(portable_simd)]
122-
/// # #[cfg(feature = "std")] use core_simd::Simd;
123-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
117+
/// # use core::simd::Simd;
124118
#[doc = concat!("# use core::", stringify!($ty), "::{MIN, MAX};")]
125119
/// let xs = Simd::from_array([MIN, -2, 0, 3]);
126120
/// let unsat = xs.abs();
@@ -142,8 +136,7 @@ macro_rules! impl_int_arith {
142136
/// # Examples
143137
/// ```
144138
/// # #![feature(portable_simd)]
145-
/// # #[cfg(feature = "std")] use core_simd::Simd;
146-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
139+
/// # use core::simd::Simd;
147140
#[doc = concat!("# use core::", stringify!($ty), "::{MIN, MAX};")]
148141
/// let x = Simd::from_array([MIN, -2, 3, MAX]);
149142
/// let unsat = -x;

crates/core_simd/src/select.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ where
1414
/// # Examples
1515
/// ```
1616
/// # #![feature(portable_simd)]
17-
/// # #[cfg(feature = "std")] use core_simd::{Simd, Mask};
18-
/// # #[cfg(not(feature = "std"))] use core::simd::{Simd, Mask};
17+
/// # use core::simd::{Simd, Mask};
1918
/// let a = Simd::from_array([0, 1, 2, 3]);
2019
/// let b = Simd::from_array([4, 5, 6, 7]);
2120
/// let mask = Mask::from_array([true, false, false, true]);
@@ -45,8 +44,7 @@ where
4544
/// # Examples
4645
/// ```
4746
/// # #![feature(portable_simd)]
48-
/// # #[cfg(feature = "std")] use core_simd::Mask;
49-
/// # #[cfg(not(feature = "std"))] use core::simd::Mask;
47+
/// # use core::simd::Mask;
5048
/// let a = Mask::<i32, 4>::from_array([true, true, false, false]);
5149
/// let b = Mask::<i32, 4>::from_array([false, false, true, true]);
5250
/// let mask = Mask::<i32, 4>::from_array([true, false, false, true]);

crates/core_simd/src/swizzle.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ use crate::simd::{LaneCount, Simd, SimdElement, SupportedLaneCount};
1212
/// ## One source vector
1313
/// ```
1414
/// # #![feature(portable_simd)]
15-
/// # #[cfg(feature = "std")] use core_simd::{Simd, simd_swizzle};
16-
/// # #[cfg(not(feature = "std"))] use core::simd::{Simd, simd_swizzle};
15+
/// # use core::simd::{Simd, simd_swizzle};
1716
/// let v = Simd::<f32, 4>::from_array([0., 1., 2., 3.]);
1817
///
1918
/// // Keeping the same size
@@ -28,8 +27,7 @@ use crate::simd::{LaneCount, Simd, SimdElement, SupportedLaneCount};
2827
/// ## Two source vectors
2928
/// ```
3029
/// # #![feature(portable_simd)]
31-
/// # #[cfg(feature = "std")] use core_simd::{Simd, simd_swizzle, Which};
32-
/// # #[cfg(not(feature = "std"))] use core::simd::{Simd, simd_swizzle, Which};
30+
/// # use core::simd::{Simd, simd_swizzle, Which};
3331
/// use Which::*;
3432
/// let a = Simd::<f32, 4>::from_array([0., 1., 2., 3.]);
3533
/// let b = Simd::<f32, 4>::from_array([4., 5., 6., 7.]);
@@ -273,8 +271,7 @@ where
273271
///
274272
/// ```
275273
/// #![feature(portable_simd)]
276-
/// # #[cfg(feature = "std")] use core_simd::Simd;
277-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
274+
/// # use core::simd::Simd;
278275
/// let a = Simd::from_array([0, 1, 2, 3]);
279276
/// let b = Simd::from_array([4, 5, 6, 7]);
280277
/// let (x, y) = a.interleave(b);
@@ -337,8 +334,7 @@ where
337334
///
338335
/// ```
339336
/// #![feature(portable_simd)]
340-
/// # #[cfg(feature = "std")] use core_simd::Simd;
341-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
337+
/// # use core::simd::Simd;
342338
/// let a = Simd::from_array([0, 4, 1, 5]);
343339
/// let b = Simd::from_array([2, 6, 3, 7]);
344340
/// let (x, y) = a.deinterleave(b);

crates/core_simd/src/vector.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ where
156156
/// # Examples
157157
/// ```
158158
/// # #![feature(portable_simd)]
159-
/// # #[cfg(feature = "std")] use core_simd::Simd;
160-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
159+
/// # use core::simd::Simd;
161160
/// let floats: Simd<f32, 4> = Simd::from_array([1.9, -4.5, f32::INFINITY, f32::NAN]);
162161
/// let ints = floats.cast::<i32>();
163162
/// assert_eq!(ints, Simd::from_array([1, -4, i32::MAX, 0]));
@@ -184,8 +183,7 @@ where
184183
/// # Examples
185184
/// ```
186185
/// # #![feature(portable_simd)]
187-
/// # #[cfg(feature = "std")] use core_simd::Simd;
188-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
186+
/// # use core::simd::Simd;
189187
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
190188
/// let idxs = Simd::from_array([9, 3, 0, 5]);
191189
/// let alt = Simd::from_array([-5, -4, -3, -2]);
@@ -205,8 +203,7 @@ where
205203
/// # Examples
206204
/// ```
207205
/// # #![feature(portable_simd)]
208-
/// # #[cfg(feature = "std")] use core_simd::Simd;
209-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
206+
/// # use core::simd::Simd;
210207
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
211208
/// let idxs = Simd::from_array([9, 3, 0, 5]);
212209
///
@@ -229,8 +226,7 @@ where
229226
/// # Examples
230227
/// ```
231228
/// # #![feature(portable_simd)]
232-
/// # #[cfg(feature = "std")] use core_simd::{Simd, Mask};
233-
/// # #[cfg(not(feature = "std"))] use core::simd::{Simd, Mask};
229+
/// # use core::simd::{Simd, Mask};
234230
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
235231
/// let idxs = Simd::from_array([9, 3, 0, 5]);
236232
/// let alt = Simd::from_array([-5, -4, -3, -2]);
@@ -264,8 +260,7 @@ where
264260
/// # Examples
265261
/// ```
266262
/// # #![feature(portable_simd)]
267-
/// # #[cfg(feature = "std")] use core_simd::{Simd, Mask};
268-
/// # #[cfg(not(feature = "std"))] use core::simd::{Simd, Mask};
263+
/// # use core::simd::{Simd, Mask};
269264
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
270265
/// let idxs = Simd::from_array([9, 3, 0, 5]);
271266
/// let alt = Simd::from_array([-5, -4, -3, -2]);
@@ -300,8 +295,7 @@ where
300295
/// # Examples
301296
/// ```
302297
/// # #![feature(portable_simd)]
303-
/// # #[cfg(feature = "std")] use core_simd::Simd;
304-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
298+
/// # use core::simd::Simd;
305299
/// let mut vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
306300
/// let idxs = Simd::from_array([9, 3, 0, 0]);
307301
/// let vals = Simd::from_array([-27, 82, -41, 124]);
@@ -323,8 +317,7 @@ where
323317
/// # Examples
324318
/// ```
325319
/// # #![feature(portable_simd)]
326-
/// # #[cfg(feature = "std")] use core_simd::{Simd, Mask};
327-
/// # #[cfg(not(feature = "std"))] use core::simd::{Simd, Mask};
320+
/// # use core::simd::{Simd, Mask};
328321
/// let mut vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
329322
/// let idxs = Simd::from_array([9, 3, 0, 0]);
330323
/// let vals = Simd::from_array([-27, 82, -41, 124]);
@@ -358,8 +351,7 @@ where
358351
/// # Examples
359352
/// ```
360353
/// # #![feature(portable_simd)]
361-
/// # #[cfg(feature = "std")] use core_simd::{Simd, Mask};
362-
/// # #[cfg(not(feature = "std"))] use core::simd::{Simd, Mask};
354+
/// # use core::simd::{Simd, Mask};
363355
/// let mut vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
364356
/// let idxs = Simd::from_array([9, 3, 0, 0]);
365357
/// let vals = Simd::from_array([-27, 82, -41, 124]);

0 commit comments

Comments
 (0)