1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

numfmt: move to thiserror

This commit is contained in:
Solomon Victorino 2025-03-22 18:18:16 -06:00 committed by Sylvestre Ledru
parent 4f1d33fec3
commit e20500d1e5
3 changed files with 6 additions and 17 deletions

1
Cargo.lock generated
View file

@ -3032,6 +3032,7 @@ name = "uu_numfmt"
version = "0.0.30"
dependencies = [
"clap",
"thiserror 2.0.12",
"uucore",
]

View file

@ -19,6 +19,7 @@ path = "src/numfmt.rs"
[dependencies]
clap = { workspace = true }
uucore = { workspace = true, features = ["ranges"] }
thiserror = { workspace = true }
[[bin]]
name = "numfmt"

View file

@ -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}")
}
}
}
}