π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Simplify Rust lint exceptions and file locking
Manav Rathid4fec741302d
diff --git a/rust/apps/ensu/src-tauri/src/commands/notes.rs b/rust/apps/ensu/src-tauri/src/commands/notes.rsindex f4006c4fc2..615ac39572 100644--- a/rust/apps/ensu/src-tauri/src/commands/notes.rs+++ b/rust/apps/ensu/src-tauri/src/commands/notes.rs@@ -1,7 +1,7 @@use std::collections::{BTreeSet, HashMap};-use std::fs::{self, File, OpenOptions};#[cfg(unix)]-use std::os::fd::AsRawFd;+use std::fs::TryLockError;+use std::fs::{self, File, OpenOptions};#[cfg(unix)]use std::os::unix::fs::{OpenOptionsExt, PermissionsExt};#[cfg(windows)]@@ -1233,16 +1233,10 @@ fn acquire_notes_ownership(notes_directory: &Path) -> Result<File, ApiError> {.map_err(notes_ownership_open_error)?;#[cfg(unix)]- {- let result = unsafe { libc::flock(file.as_raw_fd(), libc::LOCK_EX | libc::LOCK_NB) };- if result != 0 {- let error = std::io::Error::last_os_error();- if error.kind() == std::io::ErrorKind::WouldBlock {- return Err(notes_in_use_error());- }- return Err(io_error(error));- }- }+ file.try_lock().map_err(|error| match error {+ TryLockError::WouldBlock => notes_in_use_error(),+ TryLockError::Error(error) => io_error(error),+ })?;Ok(file)}diff --git a/rust/crates/core/src/crypto/blob.rs b/rust/crates/core/src/crypto/blob.rsindex 1e00cf303f..7ef2562384 100644--- a/rust/crates/core/src/crypto/blob.rs+++ b/rust/crates/core/src/crypto/blob.rs@@ -215,12 +215,6 @@ mod tests {name: String,}- #[derive(serde::Deserialize, Debug)]- #[allow(dead_code)]- struct Different {- count: u64,- }-let encrypted = encrypt_json(&Original {name: "test".to_string(),@@ -229,7 +223,7 @@ mod tests {).unwrap();- let result: std::result::Result<Different, _> = decrypt_json(&encrypted, &key);+ let result: std::result::Result<u64, _> = decrypt_json(&encrypted, &key);assert!(matches!(result, Err(Error::Json(_))),"Expected Error::Json, got: {:?}",diff --git a/rust/crates/ml/src/onnx.rs b/rust/crates/ml/src/onnx.rsindex 679040fd42..254b4e8014 100644--- a/rust/crates/ml/src/onnx.rs+++ b/rust/crates/ml/src/onnx.rs@@ -381,8 +381,7 @@ fn build_and_validate_session())]let execution_provider = attempt.execution_provider();- #[cfg_attr(not(any(target_os = "ios", target_os = "macos")), allow(unused_mut))]- let mut session = match providers::build_session(model_path, attempt) {+ let session = match providers::build_session(model_path, attempt) {Ok(session) => session,Err(error) => {#[cfg(any(@@ -402,6 +401,9 @@ fn build_and_validate_session(}};+ #[cfg(any(target_os = "ios", target_os = "macos"))]+ let mut session = session;+#[cfg(any(target_os = "ios", target_os = "macos"))]if execution_provider == ExecutionProvider::CoreMl&& _validation == AccelerationValidation::GoldenRequireddiff --git a/rust/crates/ml/src/onnx/providers.rs b/rust/crates/ml/src/onnx/providers.rsindex c6434c6429..67704c5cf3 100644--- a/rust/crates/ml/src/onnx/providers.rs+++ b/rust/crates/ml/src/onnx/providers.rs@@ -193,7 +193,6 @@ pub(super) fn provider_attempt(},#[cfg(target_os = "android")]ExecutionProvider::Xnnpack => xnnpack_attempt(),- #[allow(unreachable_patterns)]_ => unreachable!("provider is not available on this platform"),}}