Fix warnings on latest rustc

This commit is contained in:
Fan Jiang 2020-03-10 18:20:52 -04:00
parent 09f316dd46
commit fe75c60325
6 changed files with 4 additions and 11 deletions

View File

@ -119,7 +119,7 @@ macro_rules! impl_from_into_asref_1D(
#[inline] #[inline]
fn into(self) -> [N; $SZ] { fn into(self) -> [N; $SZ] {
unsafe { unsafe {
let mut res: [N; $SZ] = mem::uninitialized(); let mut res: [N; $SZ] = mem::MaybeUninit::uninit().assume_init();
ptr::copy_nonoverlapping(self.data.ptr(), &mut res[0], $SZ); ptr::copy_nonoverlapping(self.data.ptr(), &mut res[0], $SZ);
res res
@ -186,7 +186,7 @@ macro_rules! impl_from_into_asref_2D(
#[inline] #[inline]
fn into(self) -> [[N; $SZRows]; $SZCols] { fn into(self) -> [[N; $SZRows]; $SZCols] {
unsafe { unsafe {
let mut res: [[N; $SZRows]; $SZCols] = mem::uninitialized(); let mut res: [[N; $SZRows]; $SZCols] = mem::MaybeUninit::uninit().assume_init();
ptr::copy_nonoverlapping(self.data.ptr(), &mut res[0][0], $SZRows * $SZCols); ptr::copy_nonoverlapping(self.data.ptr(), &mut res[0][0], $SZRows * $SZCols);
res res

View File

@ -46,7 +46,7 @@ where
#[inline] #[inline]
unsafe fn allocate_uninitialized(_: R, _: C) -> Self::Buffer { unsafe fn allocate_uninitialized(_: R, _: C) -> Self::Buffer {
mem::uninitialized() mem::MaybeUninit::uninit().assume_init()
} }
#[inline] #[inline]

View File

@ -190,7 +190,6 @@ pub trait DimName: Dim {
type Value: NamedDim<Name = Self>; type Value: NamedDim<Name = Self>;
/// The name of this dimension, i.e., the singleton `Self`. /// The name of this dimension, i.e., the singleton `Self`.
#[inline]
fn name() -> Self; fn name() -> Self;
// FIXME: this is not a very idiomatic name. // FIXME: this is not a very idiomatic name.

View File

@ -94,13 +94,11 @@ pub unsafe trait Storage<N: Scalar, R: Dim, C: Dim = U1>: Debug + Sized {
} }
/// Indicates whether this data buffer stores its elements contiguously. /// Indicates whether this data buffer stores its elements contiguously.
#[inline]
fn is_contiguous(&self) -> bool; fn is_contiguous(&self) -> bool;
/// Retrieves the data buffer as a contiguous slice. /// Retrieves the data buffer as a contiguous slice.
/// ///
/// The matrix components may not be stored in a contiguous way, depending on the strides. /// The matrix components may not be stored in a contiguous way, depending on the strides.
#[inline]
fn as_slice(&self) -> &[N]; fn as_slice(&self) -> &[N];
/// Builds a matrix data storage that does not contain any reference. /// Builds a matrix data storage that does not contain any reference.
@ -166,7 +164,6 @@ pub unsafe trait StorageMut<N: Scalar, R: Dim, C: Dim = U1>: Storage<N, R, C> {
/// Retrieves the mutable data buffer as a contiguous slice. /// Retrieves the mutable data buffer as a contiguous slice.
/// ///
/// Matrix components may not be contiguous, depending on its strides. /// Matrix components may not be contiguous, depending on its strides.
#[inline]
fn as_mut_slice(&mut self) -> &mut [N]; fn as_mut_slice(&mut self) -> &mut [N];
} }

View File

@ -7,9 +7,6 @@ use na::{
Matrix4x3, Matrix4x5, Matrix5, Matrix6, MatrixMN, RowVector3, RowVector4, RowVector5, Matrix4x3, Matrix4x5, Matrix5, Matrix6, MatrixMN, RowVector3, RowVector4, RowVector5,
Vector1, Vector2, Vector3, Vector4, Vector5, Vector6, Vector1, Vector2, Vector3, Vector4, Vector5, Vector6,
}; };
use typenum::{UInt, UTerm};
use serde_json::error::Category::Data;
use typenum::bit::{B0, B1};
#[test] #[test]
fn iter() { fn iter() {

View File

@ -130,7 +130,7 @@ fn matrix5_try_inverse_scaled_identity() {
0.0, 1.0e+20, 0.0, 0.0, 0.0, 0.0, 1.0e+20, 0.0, 0.0, 0.0,
0.0, 0.0, 1.0e+20, 0.0, 0.0, 0.0, 0.0, 1.0e+20, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0e+20, 0.0, 0.0, 0.0, 0.0, 1.0e+20, 0.0,
0.0, 0.0, 0.0, 0.0, 1.0e+20);; 0.0, 0.0, 0.0, 0.0, 1.0e+20);
let a_inv = a.try_inverse().expect("Matrix should be invertible"); let a_inv = a.try_inverse().expect("Matrix should be invertible");
assert_relative_eq!(a_inv, expected_inverse); assert_relative_eq!(a_inv, expected_inverse);