Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix linter issues

laurenspriem7ed1a88a9b03
diff --git a/mobile/apps/photos/rust/src/ml/face/align.rs b/mobile/apps/photos/rust/src/ml/face/align.rs
index 02e833d2c7..94d57a0a1f 100644
--- a/mobile/apps/photos/rust/src/ml/face/align.rs
+++ b/mobile/apps/photos/rust/src/ml/face/align.rs
@@ -344,9 +344,13 @@ fn pad_image_for_direction(image: &[Vec<i32>], direction: FaceDirection) -> Vec<
}
}
- for j in 1..=copy_cols {
- padded[0][j] = padded[2][j];
- padded[rows + 1][j] = padded[rows - 1][j];
+ {
+ let (top_rows, other_rows) = padded.split_at_mut(1);
+ top_rows[0][1..=copy_cols].copy_from_slice(&other_rows[1][1..=copy_cols]);
+ }
+ {
+ let (upper_rows, bottom_rows) = padded.split_at_mut(rows + 1);
+ bottom_rows[0][1..=copy_cols].copy_from_slice(&upper_rows[rows - 1][1..=copy_cols]);
}
for row in padded.iter_mut().take(rows + 2) {
row[0] = row[2];
diff --git a/mobile/apps/photos/rust/src/ml/onnx.rs b/mobile/apps/photos/rust/src/ml/onnx.rs
index 444fcc280d..194334f364 100644
--- a/mobile/apps/photos/rust/src/ml/onnx.rs
+++ b/mobile/apps/photos/rust/src/ml/onnx.rs
@@ -111,7 +111,7 @@ pub fn run_f32(
) -> MlResult<(Vec<i64>, Vec<f32>)> {
let input_tensor = Tensor::<f32>::from_array((input_shape, input))?;
let outputs = session.run(ort::inputs![input_tensor]?)?;
- if outputs.len() == 0 {
+ if outputs.is_empty() {
return Err(MlError::Ort("missing first output tensor".to_string()));
}
let output = &outputs[0];