From 1ad0c1ca38a42accd21cff59e54462fff0d363b4 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 26 Jun 2024 20:45:11 -0600 Subject: [PATCH 1/3] Remove use of ref to format!(...), compose output instead fmt --- atspi-common/src/error.rs | 52 ++++++++++++++++++++++++++++++--------- atspi-common/src/role.rs | 2 +- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/atspi-common/src/error.rs b/atspi-common/src/error.rs index 32b407dd..e18f6dc2 100644 --- a/atspi-common/src/error.rs +++ b/atspi-common/src/error.rs @@ -74,31 +74,56 @@ impl std::fmt::Display for AtspiError { match self { Self::Conversion(e) => f.write_str(&format!("atspi: conversion failure: {e}")), Self::MemberMatch(e) => { - f.write_str(format!("atspi: member mismatch in conversion: {e}").as_str()) + f.write_str("atspi: member mismatch in conversion: ")?; + e.fmt(f) } Self::InterfaceMatch(e) => { - f.write_str(format!("atspi: interface mismatch in conversion: {e}").as_str()) + f.write_str("atspi: interface mismatch in conversion: ")?; + e.fmt(f) } Self::UnknownBusSignature(e) => { - f.write_str(format!("atspi: Unknown bus body signature: {e:?}").as_str()) + f.write_str("atspi: Unknown bus body signature: ")?; + e.fmt(f) } Self::UnknownInterface => f.write_str("Unknown interface."), Self::MissingInterface => f.write_str("Missing interface."), Self::MissingMember => f.write_str("Missing member."), Self::MissingSignature => f.write_str("Missing signature."), - Self::UnknownRole(e) => f.write_str(&format!("atspi: Unknown role: {e}")), + Self::UnknownRole(e) => { + f.write_str("atspi: Unknown role: ")?; + e.fmt(f) + } Self::UnknownSignal => f.write_str("atspi: Unknown signal"), Self::CacheVariantMismatch => f.write_str("atspi: Cache variant mismatch"), - Self::Owned(e) => f.write_str(&format!("atspi: other error: {e}")), - Self::Zbus(e) => f.write_str(&format!("ZBus Error: {e}")), - Self::Zvariant(e) => f.write_str(&format!("Zvariant error: {e}")), - Self::ZBusNames(e) => f.write_str(&format!("ZBus_names Error: {e}")), + Self::Owned(e) => { + f.write_str("atspi: other error: ")?; + e.fmt(f) + } + Self::Zbus(e) => { + f.write_str("ZBus Error: ")?; + e.fmt(f) + } + Self::Zvariant(e) => { + f.write_str("Zvariant error: ")?; + e.fmt(f) + } + Self::ZBusNames(e) => { + f.write_str("ZBus_names Error: ")?; + e.fmt(f) + } Self::ParseError(e) => f.write_str(e), Self::PathConversionError(e) => { - f.write_str(&format!("ID cannot be extracted from the path: {e}")) + f.write_str("ID cannot be extracted from the path: ")?; + e.fmt(f) + } + Self::IO(e) => { + f.write_str("std IO Error: ")?; + e.fmt(f) + } + Self::IntConversionError(e) => { + f.write_str("Integer conversion error: ")?; + e.fmt(f) } - Self::IO(e) => f.write_str(&format!("std IO Error: {e}")), - Self::IntConversionError(e) => f.write_str(&format!("Integer conversion error: {e}")), Self::MissingName => f.write_str("Missing name for a bus."), Self::Infallible => { f.write_str("Infallible; only to trick the compiler. This should never happen.") @@ -166,7 +191,10 @@ impl std::fmt::Display for ObjectPathConversionError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::NoIdAvailable => f.write_str("No ID available in the path."), - Self::ParseError(e) => f.write_str(&format!("Failure to parse: {e}")), + Self::ParseError(e) => { + f.write_str("Failure to parse: {e}")?; + e.fmt(f) + } } } } diff --git a/atspi-common/src/role.rs b/atspi-common/src/role.rs index 417f67b1..2bbfcb70 100644 --- a/atspi-common/src/role.rs +++ b/atspi-common/src/role.rs @@ -612,7 +612,7 @@ impl Role { impl std::fmt::Display for Role { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.name()) + f.write_str(self.name()) } } From 3c0e50c3bdb9c9cec900ee6e044824851faee34c Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 13 Aug 2024 18:52:43 -0600 Subject: [PATCH 2/3] Update versions for release update dependencies fix import Action fix category --- atspi-common/Cargo.toml | 2 +- atspi-connection/Cargo.toml | 8 ++++---- atspi-proxies/Cargo.toml | 4 ++-- atspi-proxies/src/action.rs | 2 +- atspi/Cargo.toml | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/atspi-common/Cargo.toml b/atspi-common/Cargo.toml index 01166f32..59b4b3be 100644 --- a/atspi-common/Cargo.toml +++ b/atspi-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "atspi-common" -version = "0.6.0" +version = "0.7.0" edition = "2021" readme = "README.md" categories = ["accessibility", "api-bindings"] diff --git a/atspi-connection/Cargo.toml b/atspi-connection/Cargo.toml index ae4d829c..17f034e5 100644 --- a/atspi-connection/Cargo.toml +++ b/atspi-connection/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "atspi-connection" -version = "0.6.0" +version = "0.7.0" edition = "2021" description = "A method of connecting, querying, sending and receiving over AT-SPI." license = "Apache-2.0 OR MIT" keywords = ["screen-reader", "accessibility", "a11y", "linux"] -categories = ["accessibility", "API bindings"] +categories = ["accessibility"] rust-version.workspace = true repository = "https://github.com/odilia-app/atspi/" readme = "README.md" @@ -20,8 +20,8 @@ async-std = ["zbus/async-io", "atspi-proxies/async-std", "atspi-common/async-std tokio = ["zbus/tokio", "atspi-proxies/tokio", "atspi-common/tokio"] [dependencies] -atspi-common = { path = "../atspi-common/", version = "0.6.0", default-features = false } -atspi-proxies = { path = "../atspi-proxies/", version = "0.6.0", default-features = false } +atspi-common = { path = "../atspi-common/", version = "0.7.0", default-features = false } +atspi-proxies = { path = "../atspi-proxies/", version = "0.7.0", default-features = false } futures-lite = { version = "2", default-features = false } tracing = { optional = true, workspace = true } zbus.workspace = true diff --git a/atspi-proxies/Cargo.toml b/atspi-proxies/Cargo.toml index a5c507f8..1ec28abd 100644 --- a/atspi-proxies/Cargo.toml +++ b/atspi-proxies/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "atspi-proxies" -version = "0.6.0" +version = "0.7.0" description = "AT-SPI2 proxies to query or manipulate UI objects" license = "Apache-2.0 OR MIT" readme = "README.md" @@ -23,7 +23,7 @@ gvariant = ["zvariant/gvariant"] tokio = ["zbus/tokio", "atspi-common/tokio"] [dependencies] -atspi-common = { path = "../atspi-common", version = "0.6.0", default-features = false } +atspi-common = { path = "../atspi-common", version = "0.7.0", default-features = false } serde = { version = "^1.0", default-features = false, features = ["derive"] } zbus = { workspace = true } zvariant = { version = "4.1", default-features = false } diff --git a/atspi-proxies/src/action.rs b/atspi-proxies/src/action.rs index c7241173..233fc233 100644 --- a/atspi-proxies/src/action.rs +++ b/atspi-proxies/src/action.rs @@ -17,7 +17,7 @@ //! [TextProxy]: crate::text::TextProxy //! [ValueProxy]: crate::value::ValueProxy -use atspi_common::Action; +use atspi_common::action::Action; /// A handle for a remote object implementing the `org.a11y.atspi.Action` /// interface. diff --git a/atspi/Cargo.toml b/atspi/Cargo.toml index 5285509e..3a9e60f8 100644 --- a/atspi/Cargo.toml +++ b/atspi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "atspi" -version = "0.22.0" +version = "0.23.0" authors.workspace = true edition = "2021" description = "Pure-Rust, zbus-based AT-SPI2 protocol implementation." @@ -29,9 +29,9 @@ connection-tokio = ["atspi-connection/tokio", "connection"] tracing = ["atspi-connection/tracing"] [dependencies] -atspi-common = { path = "../atspi-common", version = "0.6.0", default-features = false } -atspi-connection = { path = "../atspi-connection", version = "0.6.0", default-features = false, optional = true } -atspi-proxies = { path = "../atspi-proxies", version = "0.6.0", default-features = false, optional = true } +atspi-common = { path = "../atspi-common", version = "0.7.0", default-features = false } +atspi-connection = { path = "../atspi-connection", version = "0.7.0", default-features = false, optional = true } +atspi-proxies = { path = "../atspi-proxies", version = "0.7.0", default-features = false, optional = true } zbus = { workspace = true, default-features = false, optional = true } [[bench]] From 97b0dcd8bf2229145dc636750b8165b69fec161f Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 13 Aug 2024 19:14:59 -0600 Subject: [PATCH 3/3] Fix action exports, and dev dependencies --- atspi-common/Cargo.toml | 2 +- atspi-connection/Cargo.toml | 6 +++--- atspi-proxies/Cargo.toml | 6 +++--- atspi-proxies/src/action.rs | 2 +- atspi/Cargo.toml | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/atspi-common/Cargo.toml b/atspi-common/Cargo.toml index 59b4b3be..c1c86833 100644 --- a/atspi-common/Cargo.toml +++ b/atspi-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "atspi-common" -version = "0.7.0" +version = "0.8.0" edition = "2021" readme = "README.md" categories = ["accessibility", "api-bindings"] diff --git a/atspi-connection/Cargo.toml b/atspi-connection/Cargo.toml index 17f034e5..9a0b23ae 100644 --- a/atspi-connection/Cargo.toml +++ b/atspi-connection/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "atspi-connection" -version = "0.7.0" +version = "0.8.0" edition = "2021" description = "A method of connecting, querying, sending and receiving over AT-SPI." license = "Apache-2.0 OR MIT" @@ -20,8 +20,8 @@ async-std = ["zbus/async-io", "atspi-proxies/async-std", "atspi-common/async-std tokio = ["zbus/tokio", "atspi-proxies/tokio", "atspi-common/tokio"] [dependencies] -atspi-common = { path = "../atspi-common/", version = "0.7.0", default-features = false } -atspi-proxies = { path = "../atspi-proxies/", version = "0.7.0", default-features = false } +atspi-common = { path = "../atspi-common/", version = "0.8.0", default-features = false } +atspi-proxies = { path = "../atspi-proxies/", version = "0.8.0", default-features = false } futures-lite = { version = "2", default-features = false } tracing = { optional = true, workspace = true } zbus.workspace = true diff --git a/atspi-proxies/Cargo.toml b/atspi-proxies/Cargo.toml index 1ec28abd..ce36ac61 100644 --- a/atspi-proxies/Cargo.toml +++ b/atspi-proxies/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "atspi-proxies" -version = "0.7.0" +version = "0.8.0" description = "AT-SPI2 proxies to query or manipulate UI objects" license = "Apache-2.0 OR MIT" readme = "README.md" @@ -23,14 +23,14 @@ gvariant = ["zvariant/gvariant"] tokio = ["zbus/tokio", "atspi-common/tokio"] [dependencies] -atspi-common = { path = "../atspi-common", version = "0.7.0", default-features = false } +atspi-common = { path = "../atspi-common", version = "0.8.0", default-features = false } serde = { version = "^1.0", default-features = false, features = ["derive"] } zbus = { workspace = true } zvariant = { version = "4.1", default-features = false } [dev-dependencies] async-std = { version = "1", features = ["attributes"] } -atspi-common = { path = "../atspi-common", version = "0.6.0", features = ["async-std"] } +atspi-common = { path = "../atspi-common", version = "0.8.0", features = ["async-std"] } byteorder = "1.4" futures-lite = { version = "2", default-features = false } rename-item = "0.1.0" diff --git a/atspi-proxies/src/action.rs b/atspi-proxies/src/action.rs index 233fc233..c7241173 100644 --- a/atspi-proxies/src/action.rs +++ b/atspi-proxies/src/action.rs @@ -17,7 +17,7 @@ //! [TextProxy]: crate::text::TextProxy //! [ValueProxy]: crate::value::ValueProxy -use atspi_common::action::Action; +use atspi_common::Action; /// A handle for a remote object implementing the `org.a11y.atspi.Action` /// interface. diff --git a/atspi/Cargo.toml b/atspi/Cargo.toml index 3a9e60f8..9d22e23f 100644 --- a/atspi/Cargo.toml +++ b/atspi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "atspi" -version = "0.23.0" +version = "0.24.0" authors.workspace = true edition = "2021" description = "Pure-Rust, zbus-based AT-SPI2 protocol implementation." @@ -29,9 +29,9 @@ connection-tokio = ["atspi-connection/tokio", "connection"] tracing = ["atspi-connection/tracing"] [dependencies] -atspi-common = { path = "../atspi-common", version = "0.7.0", default-features = false } -atspi-connection = { path = "../atspi-connection", version = "0.7.0", default-features = false, optional = true } -atspi-proxies = { path = "../atspi-proxies", version = "0.7.0", default-features = false, optional = true } +atspi-common = { path = "../atspi-common", version = "0.8.0", default-features = false } +atspi-connection = { path = "../atspi-connection", version = "0.8.0", default-features = false, optional = true } +atspi-proxies = { path = "../atspi-proxies", version = "0.8.0", default-features = false, optional = true } zbus = { workspace = true, default-features = false, optional = true } [[bench]]