diff --git a/Cargo.lock b/Cargo.lock index 2e9225db..7b851146 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -306,9 +306,9 @@ checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] name = "bytes" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "cargo-credential" @@ -972,9 +972,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" [[package]] name = "num-integer" @@ -1811,9 +1811,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.45" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", "itoa", @@ -1828,15 +1828,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.25" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" dependencies = [ "num-conv", "time-core", diff --git a/Cargo.toml b/Cargo.toml index f996f29b..8292af51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ categories = ["os::linux-apis", "os", "api-bindings"] repository = "https://github.com/bilelmoussaoui/oo7" homepage = "https://github.com/bilelmoussaoui/oo7" license = "MIT" -rust-version = "1.86" +rust-version = "1.88" exclude = ["org.freedesktop.Secrets.xml"] [workspace.dependencies] diff --git a/client/src/file/api/legacy_keyring.rs b/client/src/file/api/legacy_keyring.rs index 7da45cc3..c0f9dd9d 100644 --- a/client/src/file/api/legacy_keyring.rs +++ b/client/src/file/api/legacy_keyring.rs @@ -195,7 +195,7 @@ impl Keyring { if size > cursor.get_ref()[pos..].len() { return Err(Error::NoData); } - if size % 16 != 0 { + if !size.is_multiple_of(16) { size = (size / 16) * 16; } let encrypted_content = Vec::from(&cursor.get_ref()[pos..pos + size]); diff --git a/deny.toml b/deny.toml index dedb700d..e69825c3 100644 --- a/deny.toml +++ b/deny.toml @@ -20,7 +20,6 @@ allow = [ [sources] allow-git = [ - "https://github.com/bilelmoussaoui/ashpd" ] [bans] diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 8225504d..ae47ddfd 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -175,18 +175,14 @@ pub fn derive_secret_schema(input: TokenStream) -> TokenStream { /// Extract the schema name from #[schema(name = "...")] attribute fn extract_schema_name(attrs: &[syn::Attribute]) -> Option { for attr in attrs { - if attr.path().is_ident("schema") { - if let Meta::List(meta_list) = &attr.meta { - if let Ok(name_value) = meta_list.parse_args::() { - if name_value.path.is_ident("name") { - if let syn::Expr::Lit(expr_lit) = &name_value.value { - if let Lit::Str(lit_str) = &expr_lit.lit { - return Some(lit_str.value()); - } - } - } - } - } + if attr.path().is_ident("schema") + && let Meta::List(meta_list) = &attr.meta + && let Ok(name_value) = meta_list.parse_args::() + && name_value.path.is_ident("name") + && let syn::Expr::Lit(expr_lit) = &name_value.value + && let Lit::Str(lit_str) = &expr_lit.lit + { + return Some(lit_str.value()); } } None @@ -194,10 +190,10 @@ fn extract_schema_name(attrs: &[syn::Attribute]) -> Option { /// Check if a type is Option fn is_option_type(ty: &Type) -> bool { - if let Type::Path(TypePath { path, .. }) = ty { - if let Some(segment) = path.segments.last() { - return segment.ident == "Option"; - } + if let Type::Path(TypePath { path, .. }) = ty + && let Some(segment) = path.segments.last() + { + return segment.ident == "Option"; } false } @@ -210,16 +206,13 @@ fn is_option_type(ty: &Type) -> bool { /// with is_option_type(). If called with a non-Option type, it will cause a /// compile error in the generated code. fn extract_option_inner_type(ty: &Type) -> &Type { - if let Type::Path(TypePath { path, .. }) = ty { - if let Some(segment) = path.segments.last() { - if segment.ident == "Option" { - if let syn::PathArguments::AngleBracketed(args) = &segment.arguments { - if let Some(syn::GenericArgument::Type(inner_ty)) = args.args.first() { - return inner_ty; - } - } - } - } + if let Type::Path(TypePath { path, .. }) = ty + && let Some(segment) = path.segments.last() + && segment.ident == "Option" + && let syn::PathArguments::AngleBracketed(args) = &segment.arguments + && let Some(syn::GenericArgument::Type(inner_ty)) = args.args.first() + { + return inner_ty; } // This should never be reached if is_option_type() returned true // Return the original type as a fallback - this will cause a compile error diff --git a/pam/src/lib.rs b/pam/src/lib.rs index fa6c8068..ff150031 100644 --- a/pam/src/lib.rs +++ b/pam/src/lib.rs @@ -228,11 +228,11 @@ pub unsafe extern "C" fn pam_sm_open_session( let arg_ptr = unsafe { *argv.offset(i as isize) }; if !arg_ptr.is_null() { let arg_cstr = unsafe { CStr::from_ptr(arg_ptr) }; - if let Ok(arg_str) = arg_cstr.to_str() { - if arg_str == "auto_start" { - auto_start = true; - tracing::debug!("auto_start argument detected"); - } + if let Ok(arg_str) = arg_cstr.to_str() + && arg_str == "auto_start" + { + auto_start = true; + tracing::debug!("auto_start argument detected"); } } } diff --git a/server/src/capability.rs b/server/src/capability.rs index d7671ddf..697be777 100644 --- a/server/src/capability.rs +++ b/server/src/capability.rs @@ -135,10 +135,10 @@ pub fn drop_unnecessary_capabilities() -> Result<(), rustix::io::Errno> { } // Clear bounding set if we have CAP_SETPCAP (do this before dropping caps) - if caps.effective.contains(CapabilitySet::SETPCAP) { - if let Err(err) = set_bounding_set(CapabilitySet::IPC_LOCK) { - tracing::warn!("Failed to set bounding set: {}", err); - } + if caps.effective.contains(CapabilitySet::SETPCAP) + && let Err(err) = set_bounding_set(CapabilitySet::IPC_LOCK) + { + tracing::warn!("Failed to set bounding set: {}", err); } set_capabilities( diff --git a/server/src/collection/mod.rs b/server/src/collection/mod.rs index 729c4eff..f71e1190 100644 --- a/server/src/collection/mod.rs +++ b/server/src/collection/mod.rs @@ -498,10 +498,10 @@ impl Collection { Ok(unlocked) => unlocked, Err(err) => { // Reload the locked keyring from disk before returning error - if let Some(path) = keyring_path { - if let Ok(reloaded) = oo7::file::LockedKeyring::load(&path).await { - *keyring_guard = Some(Keyring::Locked(reloaded)); - } + if let Some(path) = keyring_path + && let Ok(reloaded) = oo7::file::LockedKeyring::load(&path).await + { + *keyring_guard = Some(Keyring::Locked(reloaded)); } return Err(custom_service_error(&format!( "Failed to unlock keyring: {err}" diff --git a/server/src/item/mod.rs b/server/src/item/mod.rs index 5fb76a29..eefdd584 100644 --- a/server/src/item/mod.rs +++ b/server/src/item/mod.rs @@ -190,13 +190,13 @@ impl Item { let signal_emitter = self.service.signal_emitter(&self.collection_path)?; Collection::item_changed(&signal_emitter, &self.path).await?; - if let Ok(signal_emitter) = self.service.signal_emitter(&self.path) { - if let Err(err) = self.modified_changed(&signal_emitter).await { - tracing::error!( - "Failed to emit PropertiesChanged signal for Modified: {}", - err - ); - } + if let Ok(signal_emitter) = self.service.signal_emitter(&self.path) + && let Err(err) = self.modified_changed(&signal_emitter).await + { + tracing::error!( + "Failed to emit PropertiesChanged signal for Modified: {}", + err + ); } Ok(()) diff --git a/server/src/service/mod.rs b/server/src/service/mod.rs index f4fe3b86..2ab4583a 100644 --- a/server/src/service/mod.rs +++ b/server/src/service/mod.rs @@ -994,10 +994,10 @@ impl Service { // assumes all items are from the same collection if let Some(path_str) = objects.first().and_then(|p| p.as_str().rsplit_once('/')) { let collection_path = path_str.0; - if let Ok(obj_path) = ObjectPath::try_from(collection_path) { - if let Some(collection) = self.collection_from_path(&obj_path).await { - return collection.label().await; - } + if let Ok(obj_path) = ObjectPath::try_from(collection_path) + && let Some(collection) = self.collection_from_path(&obj_path).await + { + return collection.label().await; } } @@ -1102,18 +1102,17 @@ impl Service { .await .insert(collection_path.clone(), collection.clone()); - if alias == oo7::dbus::Service::DEFAULT_COLLECTION { - if let Err(e) = self + if alias == oo7::dbus::Service::DEFAULT_COLLECTION + && let Err(e) = self .object_server() .at(DEFAULT_COLLECTION_ALIAS_PATH, collection) .await - { - tracing::error!( - "Failed to register default alias for migrated collection '{}': {}", - name, - e - ); - } + { + tracing::error!( + "Failed to register default alias for migrated collection '{}': {}", + name, + e + ); } if let Ok(signal_emitter) =