about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libstd/ptr.rs1
-rw-r--r--src/libstd/util.rs4
2 files changed, 2 insertions, 3 deletions
diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs
index f6cc00ccc86..1a822ca62cb 100644
--- a/src/libstd/ptr.rs
+++ b/src/libstd/ptr.rs
@@ -103,6 +103,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
     let n = count * sys::size_of::<T>();
     memmove32(dst as *mut u8, src as *u8, n as u32);
 }
+
 #[inline(always)]
 #[cfg(target_word_size = "64")]
 pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
diff --git a/src/libstd/util.rs b/src/libstd/util.rs
index e2b91594d12..53de853ad46 100644
--- a/src/libstd/util.rs
+++ b/src/libstd/util.rs
@@ -61,8 +61,6 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
  */
 #[inline]
 pub unsafe fn swap_ptr<T>(x: *mut T, y: *mut T) {
-    if x == y { return }
-
     // Give ourselves some scratch space to work with
     let mut tmp: T = intrinsics::uninit();
     let t = ptr::to_mut_unsafe_ptr(&mut tmp);
@@ -72,7 +70,7 @@ pub unsafe fn swap_ptr<T>(x: *mut T, y: *mut T) {
     ptr::copy_memory(x, y, 1);
     ptr::copy_memory(y, t, 1);
 
-    // y and t now point to the same thing, but we need to completely forget t
+    // y and t now point to the same thing, but we need to completely forget `tmp`
     // because it's no longer relevant.
     cast::forget(tmp);
 }