transfer_region refactor 2
Remove `.checked_sub` where logic makes this unnecessary
This commit is contained in:
parent
5acae8ffde
commit
1ca011f69c
|
|
@ -297,12 +297,12 @@ impl TransferRegion {
|
|||
let (s_ul, s_br) =
|
||||
standardize_rectangle(&source_corners.0, &source_corners.1);
|
||||
let s_dims = (
|
||||
s_br.row.checked_sub(s_ul.row).unwrap() + 1,
|
||||
s_br.col.checked_sub(s_ul.col).unwrap() + 1,
|
||||
s_br.row - s_ul.row + 1,
|
||||
s_br.col - s_ul.col + 1,
|
||||
);
|
||||
let d_dims = (
|
||||
d_br.row.checked_sub(d_ul.row).unwrap() + 1,
|
||||
d_br.col.checked_sub(d_ul.col).unwrap() + 1,
|
||||
d_br.row - d_ul.row + 1,
|
||||
d_br.col - d_ul.col + 1,
|
||||
);
|
||||
let number_used_src_wells = (
|
||||
// Number of used source wells
|
||||
|
|
@ -341,8 +341,8 @@ impl TransferRegion {
|
|||
.into_iter()
|
||||
.filter(|Well { row: x, col: y }| {
|
||||
// Compute row and column offsets once
|
||||
let row_offset = x.checked_sub(d_ul.row).unwrap();
|
||||
let col_offset = y.checked_sub(d_ul.col).unwrap();
|
||||
let row_offset = x - d_ul.row;
|
||||
let col_offset = y - d_ul.col;
|
||||
|
||||
// Row position check
|
||||
let row_matches = row_offset % row_modulus
|
||||
|
|
|
|||
Loading…
Reference in New Issue