Skip to content

Commit c66f512

Browse files
Clean up use of cargo feature "std"
1 parent 4d7c739 commit c66f512

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
@@ -153,8 +153,7 @@ where
153153
/// # Examples
154154
/// ```
155155
/// # #![feature(portable_simd)]
156-
/// # #[cfg(feature = "std")] use core_simd::Simd;
157-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
156+
/// # use core::simd::Simd;
158157
/// let floats: Simd<f32, 4> = Simd::from_array([1.9, -4.5, f32::INFINITY, f32::NAN]);
159158
/// let ints = floats.cast::<i32>();
160159
/// assert_eq!(ints, Simd::from_array([1, -4, i32::MAX, 0]));
@@ -180,8 +179,7 @@ where
180179
/// # Examples
181180
/// ```
182181
/// # #![feature(portable_simd)]
183-
/// # #[cfg(feature = "std")] use core_simd::Simd;
184-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
182+
/// # use core::simd::Simd;
185183
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
186184
/// let idxs = Simd::from_array([9, 3, 0, 5]);
187185
/// let alt = Simd::from_array([-5, -4, -3, -2]);
@@ -201,8 +199,7 @@ where
201199
/// # Examples
202200
/// ```
203201
/// # #![feature(portable_simd)]
204-
/// # #[cfg(feature = "std")] use core_simd::Simd;
205-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
202+
/// # use core::simd::Simd;
206203
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
207204
/// let idxs = Simd::from_array([9, 3, 0, 5]);
208205
///
@@ -225,8 +222,7 @@ where
225222
/// # Examples
226223
/// ```
227224
/// # #![feature(portable_simd)]
228-
/// # #[cfg(feature = "std")] use core_simd::{Simd, Mask};
229-
/// # #[cfg(not(feature = "std"))] use core::simd::{Simd, Mask};
225+
/// # use core::simd::{Simd, Mask};
230226
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
231227
/// let idxs = Simd::from_array([9, 3, 0, 5]);
232228
/// let alt = Simd::from_array([-5, -4, -3, -2]);
@@ -260,8 +256,7 @@ where
260256
/// # Examples
261257
/// ```
262258
/// # #![feature(portable_simd)]
263-
/// # #[cfg(feature = "std")] use core_simd::{Simd, Mask};
264-
/// # #[cfg(not(feature = "std"))] use core::simd::{Simd, Mask};
259+
/// # use core::simd::{Simd, Mask};
265260
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
266261
/// let idxs = Simd::from_array([9, 3, 0, 5]);
267262
/// let alt = Simd::from_array([-5, -4, -3, -2]);
@@ -296,8 +291,7 @@ where
296291
/// # Examples
297292
/// ```
298293
/// # #![feature(portable_simd)]
299-
/// # #[cfg(feature = "std")] use core_simd::Simd;
300-
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
294+
/// # use core::simd::Simd;
301295
/// let mut vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
302296
/// let idxs = Simd::from_array([9, 3, 0, 0]);
303297
/// let vals = Simd::from_array([-27, 82, -41, 124]);
@@ -319,8 +313,7 @@ where
319313
/// # Examples
320314
/// ```
321315
/// # #![feature(portable_simd)]
322-
/// # #[cfg(feature = "std")] use core_simd::{Simd, Mask};
323-
/// # #[cfg(not(feature = "std"))] use core::simd::{Simd, Mask};
316+
/// # use core::simd::{Simd, Mask};
324317
/// let mut vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
325318
/// let idxs = Simd::from_array([9, 3, 0, 0]);
326319
/// let vals = Simd::from_array([-27, 82, -41, 124]);
@@ -354,8 +347,7 @@ where
354347
/// # Examples
355348
/// ```
356349
/// # #![feature(portable_simd)]
357-
/// # #[cfg(feature = "std")] use core_simd::{Simd, Mask};
358-
/// # #[cfg(not(feature = "std"))] use core::simd::{Simd, Mask};
350+
/// # use core::simd::{Simd, Mask};
359351
/// let mut vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
360352
/// let idxs = Simd::from_array([9, 3, 0, 0]);
361353
/// let vals = Simd::from_array([-27, 82, -41, 124]);

0 commit comments

Comments
 (0)