From 0e37cd22ac91aa55c6b717f0217e2d01aaca010b Mon Sep 17 00:00:00 2001 From: overtrue Date: Thu, 13 Aug 2026 02:08:49 +0800 Subject: [PATCH] chore(heal): remove seven dead error variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit heal::Error carried six variants with zero construction and zero match sites (ConfigurationError, NotFound, TaskAlreadyExists, ManagerNotRunning, EventProcessingFailed, ProgressTrackingFailed) plus IO(String), which was never constructed either — its only appearances were two or-pattern match arms that could never fire (task.rs's demotion match and the recoverability classifier). All seven are deleted and the two or-patterns lose their dead alternative. Config(String) stays (live, four construction sites); Io(std::io::Error) stays; the retry classifier's behavior is untouched per the issue constraint — removing an arm that can never match is not a classification change. Ref rustfs/backlog#1831 (PR3). --- crates/heal/src/error.rs | 25 +------------------------ crates/heal/src/heal/task.rs | 2 +- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/crates/heal/src/error.rs b/crates/heal/src/error.rs index 10da452ae..68ca7eef4 100644 --- a/crates/heal/src/error.rs +++ b/crates/heal/src/error.rs @@ -34,36 +34,21 @@ pub enum Error { #[error("Configuration error: {0}")] Config(String), - #[error("Heal configuration error: {message}")] - ConfigurationError { message: String }, - #[error("Other error: {0}")] Other(String), #[error("Serialization error: {0}")] Serialization(String), - #[error("IO error: {0}")] - IO(String), - - #[error("Not found: {0}")] - NotFound(String), - #[error("Invalid checkpoint: {0}")] InvalidCheckpoint(String), #[error("Heal task not found: {task_id}")] TaskNotFound { task_id: String }, - #[error("Heal task already exists: {task_id}")] - TaskAlreadyExists { task_id: String }, - #[error("Invalid heal client token")] InvalidClientToken, - #[error("Heal manager is not running")] - ManagerNotRunning, - #[error("Heal task execution failed: {message}")] TaskExecutionFailed { message: String }, @@ -78,12 +63,6 @@ pub enum Error { #[error("Heal task timeout")] TaskTimeout, - - #[error("Heal event processing failed: {message}")] - EventProcessingFailed { message: String }, - - #[error("Heal progress tracking failed: {message}")] - ProgressTrackingFailed { message: String }, } /// A specialized Result type for heal operations @@ -129,9 +108,7 @@ impl Error { | DiskError::FaultyDisk ) || is_recoverable_heal_error_message(&err.to_string()) } - Error::TaskExecutionFailed { message } | Error::IO(message) | Error::Other(message) => { - is_recoverable_heal_error_message(message) - } + Error::TaskExecutionFailed { message } | Error::Other(message) => is_recoverable_heal_error_message(message), Error::Io(err) => is_recoverable_heal_error_message(&err.to_string()), _ => false, } diff --git a/crates/heal/src/heal/task.rs b/crates/heal/src/heal/task.rs index 6937f69e7..916b51822 100644 --- a/crates/heal/src/heal/task.rs +++ b/crates/heal/src/heal/task.rs @@ -597,7 +597,7 @@ impl HealTask { | EcstoreError::ObjectNotFound(_, _) | EcstoreError::VersionNotFound(_, _, _), ) => true, - Error::Other(message) | Error::IO(message) => { + Error::Other(message) => { message.contains("File not found") || message.contains("file not found") || message.contains("File version not found")