From 62b4cce2fbbb3645cef189717756503565144406 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Tue, 25 Nov 2025 22:56:26 +0100 Subject: [PATCH] Replace single thiserror usage with manual trait implementations --- Cargo.lock | 1 - platforms/atspi-common/Cargo.toml | 1 - platforms/atspi-common/src/error.rs | 25 ++++++++++++++++++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 85922cd80..156bbc0bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,7 +46,6 @@ dependencies = [ "accesskit_consumer", "atspi-common", "serde", - "thiserror", "zvariant", ] diff --git a/platforms/atspi-common/Cargo.toml b/platforms/atspi-common/Cargo.toml index 88f5cd5ef..4767c6904 100644 --- a/platforms/atspi-common/Cargo.toml +++ b/platforms/atspi-common/Cargo.toml @@ -19,6 +19,5 @@ accesskit = { version = "0.21.1", path = "../../common" } accesskit_consumer = { version = "0.31.0", path = "../../consumer" } atspi-common = { version = "0.9", default-features = false } serde = "1.0" -thiserror = "1.0" zvariant = { version = "5.4", default-features = false } diff --git a/platforms/atspi-common/src/error.rs b/platforms/atspi-common/src/error.rs index 9fff5927b..b61290324 100644 --- a/platforms/atspi-common/src/error.rs +++ b/platforms/atspi-common/src/error.rs @@ -3,20 +3,31 @@ // the LICENSE-APACHE file) or the MIT license (found in // the LICENSE-MIT file), at your option. -#[derive(Debug, thiserror::Error)] +use std::fmt; + +#[derive(Debug)] pub enum Error { - #[error("defunct")] Defunct, - #[error("unsupported interface")] UnsupportedInterface, - #[error("too many children")] TooManyChildren, - #[error("index out of range")] IndexOutOfRange, - #[error("too many characters")] TooManyCharacters, - #[error("unsupported text granularity")] UnsupportedTextGranularity, } +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(match self { + Self::Defunct => "defunct", + Self::UnsupportedInterface => "unsupported interface", + Self::TooManyChildren => "too many children", + Self::IndexOutOfRange => "index out of range", + Self::TooManyCharacters => "too many characters", + Self::UnsupportedTextGranularity => "unsupported text granularity", + }) + } +} + +impl std::error::Error for Error {} + pub type Result = std::result::Result;