Преглед на файлове

Use mem::swap to swap variables

Matt Ickstadt преди 8 години
родител
ревизия
da53b70d34
променени са 1 файла, в които са добавени 1 реда и са изтрити 3 реда
  1. 1 3
      src/float/add.rs

+ 1 - 3
src/float/add.rs

@@ -74,9 +74,7 @@ macro_rules! add {
 
             // Swap a and b if necessary so that a has the larger absolute value.
             if b_abs > a_abs {
-                let temp = a_rep;
-                a_rep = b_rep;
-                b_rep = temp;
+                ::core::mem::swap(&mut a_rep, &mut b_rep);
             }
 
             // Extract the exponent and significand from the (possibly swapped) a and b.