mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
numfmt: move to thiserror
This commit is contained in:
committed by
Sylvestre Ledru
parent
4f1d33fec3
commit
e20500d1e5
Generated
+1
@@ -3032,6 +3032,7 @@ name = "uu_numfmt"
|
||||
version = "0.0.30"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"thiserror 2.0.12",
|
||||
"uucore",
|
||||
]
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ path = "src/numfmt.rs"
|
||||
[dependencies]
|
||||
clap = { workspace = true }
|
||||
uucore = { workspace = true, features = ["ranges"] }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
[[bin]]
|
||||
name = "numfmt"
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
use std::{
|
||||
error::Error,
|
||||
fmt::{Debug, Display},
|
||||
};
|
||||
use std::fmt::Debug;
|
||||
use thiserror::Error;
|
||||
use uucore::error::UError;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Error)]
|
||||
#[error("{0}")]
|
||||
pub enum NumfmtError {
|
||||
IoError(String),
|
||||
IllegalArgument(String),
|
||||
@@ -25,15 +24,3 @@ impl UError for NumfmtError {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for NumfmtError {}
|
||||
|
||||
impl Display for NumfmtError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::IoError(s) | Self::IllegalArgument(s) | Self::FormattingError(s) => {
|
||||
write!(f, "{s}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user