Skip to content

Commit 4ea7bb8

Browse files
committed
Move Layouts instead of binding by reference
1 parent e862c01 commit 4ea7bb8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/libcore/alloc.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1143,9 +1143,9 @@ pub unsafe trait Alloc {
11431143
where Self: Sized
11441144
{
11451145
match Layout::array::<T>(n) {
1146-
Ok(ref layout) if layout.size() > 0 => {
1146+
Ok(layout) if layout.size() > 0 => {
11471147
unsafe {
1148-
self.alloc(layout.clone()).map(|p| p.cast())
1148+
self.alloc(layout).map(|p| p.cast())
11491149
}
11501150
}
11511151
_ => Err(AllocErr),
@@ -1193,9 +1193,9 @@ pub unsafe trait Alloc {
11931193
where Self: Sized
11941194
{
11951195
match (Layout::array::<T>(n_old), Layout::array::<T>(n_new)) {
1196-
(Ok(ref k_old), Ok(ref k_new)) if k_old.size() > 0 && k_new.size() > 0 => {
1196+
(Ok(k_old), Ok(k_new)) if k_old.size() > 0 && k_new.size() > 0 => {
11971197
debug_assert!(k_old.align() == k_new.align());
1198-
self.realloc(ptr.cast(), k_old.clone(), k_new.size()).map(NonNull::cast)
1198+
self.realloc(ptr.cast(), k_old, k_new.size()).map(NonNull::cast)
11991199
}
12001200
_ => {
12011201
Err(AllocErr)
@@ -1227,8 +1227,8 @@ pub unsafe trait Alloc {
12271227
where Self: Sized
12281228
{
12291229
match Layout::array::<T>(n) {
1230-
Ok(ref k) if k.size() > 0 => {
1231-
Ok(self.dealloc(ptr.cast(), k.clone()))
1230+
Ok(k) if k.size() > 0 => {
1231+
Ok(self.dealloc(ptr.cast(), k))
12321232
}
12331233
_ => {
12341234
Err(AllocErr)

0 commit comments

Comments
 (0)