Skip to content

Commit c17e2b9

Browse files
committed
remove CargoTomlError
1 parent b0565d8 commit c17e2b9

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

src/format_report_formatter.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,5 @@ fn error_kind_to_snippet_annotation_type(error_kind: &ErrorKind) -> AnnotationTy
146146
| ErrorKind::InvalidGlobPattern(_)
147147
| ErrorKind::VersionMismatch => AnnotationType::Error,
148148
ErrorKind::DeprecatedAttr => AnnotationType::Warning,
149-
ErrorKind::CargoTomlError(_) => {
150-
unreachable!("Cargo.toml formatting error is not contained in FormatReport.")
151-
}
152149
}
153150
}

src/formatting/cargo_toml.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ pub(crate) fn format_cargo_toml_inner(content: &str, config: &Config) -> Result<
4242
}
4343

4444
impl From<TomlError> for ErrorKind {
45-
fn from(e: TomlError) -> Self {
46-
ErrorKind::CargoTomlError(format!("{e}"))
45+
fn from(_: TomlError) -> Self {
46+
ErrorKind::ParseError
4747
}
4848
}
4949

@@ -135,9 +135,8 @@ impl VisitMut for SortKey {
135135
let table = match section.as_table_mut() {
136136
Some(table) => table,
137137
None => {
138-
self.error = Some(ErrorKind::CargoTomlError(
139-
"package should be a table".into(),
140-
));
138+
// package should be a table
139+
self.error = Some(ErrorKind::ParseError);
141140
return;
142141
}
143142
};

src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ pub enum ErrorKind {
133133
/// Invalid glob pattern in `ignore` configuration option.
134134
#[error("Invalid glob pattern found in ignore list: {0}")]
135135
InvalidGlobPattern(ignore::Error),
136-
#[error("Error when formatting Cargo.toml: {0}")]
137-
CargoTomlError(String),
138136
}
139137

140138
impl ErrorKind {

0 commit comments

Comments
 (0)