common: Use slice.swap() to clean up SectorHeaderIter::sort().
authorTilman Sauerbeck <tilman@code-monkey.de>
Sun, 12 Jan 2020 09:41:40 +0000 (10:41 +0100)
committerTilman Sauerbeck <tilman@code-monkey.de>
Sun, 12 Jan 2020 12:03:49 +0000 (13:03 +0100)
src/common/logger.rs

index 022b155f7d1b90b9667d5291dd4b8da9115b5dbb..95f4a4342a1f0320f76a98b26d5909f217442663 100644 (file)
@@ -252,9 +252,7 @@ impl<'a> SectorHeaderIter<'a> {
         }
 
         for i in (1..num_elts_to_sort).rev() {
-            let t = self.indices[0];
-            self.indices[0] = self.indices[i];
-            self.indices[i] = t;
+            self.indices.swap(0, i);
 
             downheap(&mut self.indices, 0, i - 1, self.sector_header);
         }