Merge pull request #1112 from SolraBizna/point-construction-const-fn

Make "Point::new" a const fn
This commit is contained in:
Sébastien Crozet 2022-08-14 15:03:09 +02:00 committed by GitHub
commit 0fcf2f61d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -202,7 +202,7 @@ impl<T: Scalar> Point1<T> {
/// assert_eq!(p.x, 1.0); /// assert_eq!(p.x, 1.0);
/// ``` /// ```
#[inline] #[inline]
pub fn new(x: T) -> Self { pub const fn new(x: T) -> Self {
Point { Point {
coords: Vector1::new(x), coords: Vector1::new(x),
} }
@ -216,7 +216,7 @@ macro_rules! componentwise_constructors_impl(
#[doc = $doc] #[doc = $doc]
#[doc = "```"] #[doc = "```"]
#[inline] #[inline]
pub fn new($($args: T),*) -> Self { pub const fn new($($args: T),*) -> Self {
Point { coords: $Vector::new($($args),*) } Point { coords: $Vector::new($($args),*) }
} }
} }