File tree Expand file tree Collapse file tree 2 files changed +3
-11
lines changed Expand file tree Collapse file tree 2 files changed +3
-11
lines changed Original file line number Diff line number Diff line change 11//! Traits related to scalars.
22
3- use crate :: vector:: { VectorOrScalar , create_dim } ;
3+ use crate :: vector:: VectorOrScalar ;
44use core:: num:: NonZeroUsize ;
55
66/// Abstract trait representing a SPIR-V scalar type.
@@ -21,7 +21,7 @@ macro_rules! impl_scalar {
2121 $(
2222 unsafe impl VectorOrScalar for $ty {
2323 type Scalar = Self ;
24- const DIM : NonZeroUsize = create_dim ( 1 ) ;
24+ const DIM : NonZeroUsize = NonZeroUsize :: new ( 1 ) . unwrap ( ) ;
2525 }
2626 unsafe impl Scalar for $ty { }
2727 ) +
Original file line number Diff line number Diff line change @@ -16,14 +16,6 @@ pub unsafe trait VectorOrScalar: Copy + Default + Send + Sync + 'static {
1616 const DIM : NonZeroUsize ;
1717}
1818
19- /// replace with `NonZeroUsize::new(n).unwrap()` once `unwrap()` is const stabilized
20- pub ( crate ) const fn create_dim ( n : usize ) -> NonZeroUsize {
21- match NonZeroUsize :: new ( n) {
22- None => panic ! ( "dim must not be 0" ) ,
23- Some ( n) => n,
24- }
25- }
26-
2719/// Abstract trait representing a SPIR-V vector type.
2820///
2921/// To implement this trait, your struct must be marked with:
@@ -71,7 +63,7 @@ macro_rules! impl_vector {
7163 $( $(
7264 unsafe impl VectorOrScalar for $vec {
7365 type Scalar = $scalar;
74- const DIM : NonZeroUsize = create_dim ( $dim) ;
66+ const DIM : NonZeroUsize = NonZeroUsize :: new ( $dim) . unwrap ( ) ;
7567 }
7668 unsafe impl Vector <$scalar, $dim> for $vec { }
7769 ) +) +
You can’t perform that action at this time.
0 commit comments