rust: remove unused `StatusError::IO` enum variant
authorSimon Sapin <simon.sapin@octobus.net>
Mon, 14 Feb 2022 18:51:43 +0100
changeset 48749 6e930bc45aeb
parent 48748 00efd2d5037d
child 48750 94e36b230990
rust: remove unused `StatusError::IO` enum variant All `io::Error` cases are now handled through PatternFileWarning or BadMatch Differential Revision: https://phab.mercurial-scm.org/D12174
rust/hg-core/src/dirstate/status.rs
rust/hg-cpython/src/dirstate/status.rs
--- a/rust/hg-core/src/dirstate/status.rs	Mon Feb 14 18:57:12 2022 +0100
+++ b/rust/hg-core/src/dirstate/status.rs	Mon Feb 14 18:51:43 2022 +0100
@@ -128,8 +128,6 @@
 
 #[derive(Debug, derive_more::From)]
 pub enum StatusError {
-    /// Generic IO error
-    IO(std::io::Error),
     /// An invalid path that cannot be represented in Mercurial was found
     Path(HgPathError),
     /// An invalid "ignore" pattern was found
@@ -143,7 +141,6 @@
 impl fmt::Display for StatusError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self {
-            StatusError::IO(error) => error.fmt(f),
             StatusError::Path(error) => error.fmt(f),
             StatusError::Pattern(error) => error.fmt(f),
             StatusError::DirstateV2ParseError(_) => {
--- a/rust/hg-cpython/src/dirstate/status.rs	Mon Feb 14 18:57:12 2022 +0100
+++ b/rust/hg-cpython/src/dirstate/status.rs	Mon Feb 14 18:51:43 2022 +0100
@@ -10,7 +10,6 @@
 //! `rustext.dirstate.status`.
 
 use crate::{dirstate::DirstateMap, exceptions::FallbackError};
-use cpython::exc::OSError;
 use cpython::{
     exc::ValueError, ObjectProtocol, PyBytes, PyErr, PyList, PyObject,
     PyResult, PyTuple, Python, PythonObject, ToPyObject,
@@ -95,7 +94,6 @@
 
             PyErr::new::<FallbackError, _>(py, &as_string)
         }
-        StatusError::IO(e) => PyErr::new::<OSError, _>(py, e.to_string()),
         e => PyErr::new::<ValueError, _>(py, e.to_string()),
     }
 }