From c5f240cc281120b987a76bef213ba1007138a89c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Violeta=20Hern=C3=A1ndez?= Date: Thu, 17 Jun 2021 19:51:00 -0500 Subject: [PATCH] Fixed potential UB --- src/base/storage.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/storage.rs b/src/base/storage.rs index 1e8d5dfb..1eaa9b62 100644 --- a/src/base/storage.rs +++ b/src/base/storage.rs @@ -1,7 +1,7 @@ //! Abstract definition of a matrix data storage. use std::fmt::Debug; -use std::mem; +use std::ptr; use crate::base::allocator::{Allocator, SameShapeC, SameShapeR}; use crate::base::default_allocator::DefaultAllocator; @@ -158,7 +158,7 @@ pub unsafe trait StorageMut: Storage { let a = self.get_address_unchecked_linear_mut(i1); let b = self.get_address_unchecked_linear_mut(i2); - mem::swap(&mut *a, &mut *b); + ptr::swap(a, b); } /// Swaps two elements without bound-checking.