Skip to content

Commit 0f5fb7c

Browse files
committed
Remove unnecessary bound from Vec::map()
1 parent b784177 commit 0f5fb7c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

core/src/math/vec.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,16 @@ impl<Sp, const N: usize> Vector<[f32; N], Sp> {
153153
}
154154
}
155155

156+
impl<Sc, Sp, const N: usize> Vector<[Sc; N], Sp> {
157+
/// Returns a vector of the same dimension as `self` by applying `f`
158+
/// component-wise.
159+
#[inline]
160+
#[must_use]
161+
pub fn map<T>(self, f: impl FnMut(Sc) -> T) -> Vector<[T; N], Sp> {
162+
self.0.map(f).into()
163+
}
164+
}
165+
156166
impl<Sc, Sp, const N: usize> Vector<[Sc; N], Sp>
157167
where
158168
Self: Linear<Scalar = Sc>,
@@ -206,14 +216,6 @@ where
206216
{
207217
other.mul(self.scalar_project(other))
208218
}
209-
210-
/// Returns a vector of the same dimension as `self` by applying `f`
211-
/// component-wise.
212-
#[inline]
213-
#[must_use]
214-
pub fn map<T>(self, mut f: impl FnMut(Sc) -> T) -> Vector<[T; N], Sp> {
215-
array::from_fn(|i| f(self[i])).into()
216-
}
217219
}
218220

219221
impl<R, Sc, B> Vector<R, Real<2, B>>

0 commit comments

Comments
 (0)