more std::mem::swap changes

This commit is contained in:
Henry Schimke
2022-12-29 17:46:09 -06:00
parent 09f25bfacc
commit 1c94af40ee
2 changed files with 4 additions and 12 deletions

View File

@@ -385,12 +385,8 @@ impl Detector {
// see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
let steep = (toY as i64 - fromY as i64).abs() > (toX as i64 - fromX as i64).abs();
if steep {
let mut temp = fromX;
fromX = fromY;
fromY = temp;
temp = toX;
toX = toY;
toY = temp;
std::mem::swap(&mut fromX, &mut fromY);
std::mem::swap(&mut toX, &mut toY);
}
let dx: i32 = (toX as i64 - fromX as i64).abs() as i32;