Skip to content

Commit 4e12ee1

Browse files
Brooooooklynclaude
andauthored
style: fix clippy::enum_variant_names (#227)
Rename Error enum variants to remove redundant 'Error' suffix: - BincodeEncodeError -> BincodeEncode - BincodeDecodeError -> BincodeDecode - NixError -> Nix - SerdeError -> Serde - WaxBuildError -> WaxBuild - WaxWalkError -> WaxWalk - CycleDependenciesError -> CycleDependencies - SerdeYmlError -> SerdeYml - ViteError -> Vite - StripPathError -> StripPath - SemverError -> Semver - ReqwestError -> Reqwest - AnyhowError -> Anyhow - SqliteError -> Sqlite Also updated all usages in: - packages/cli/binding/src/lib.rs - crates/vite_package_manager/src/package_manager.rs - crates/vite_task/src/schedule.rs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 59bf13e commit 4e12ee1

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

crates/vite_error/src/lib.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ use vite_str::Str;
1212
#[derive(Error, Debug)]
1313
pub enum Error {
1414
#[error(transparent)]
15-
SqliteError(#[from] rusqlite::Error),
15+
Sqlite(#[from] rusqlite::Error),
1616

1717
#[error(transparent)]
18-
BincodeEncodeError(#[from] bincode::error::EncodeError),
18+
BincodeEncode(#[from] bincode::error::EncodeError),
1919

2020
#[error(transparent)]
21-
BincodeDecodeError(#[from] bincode::error::DecodeError),
21+
BincodeDecode(#[from] bincode::error::DecodeError),
2222

2323
#[error("Unrecognized db version: {0}")]
2424
UnrecognizedDbVersion(u32),
@@ -34,10 +34,10 @@ pub enum Error {
3434

3535
#[cfg(unix)]
3636
#[error(transparent)]
37-
NixError(#[from] nix::Error),
37+
Nix(#[from] nix::Error),
3838

3939
#[error(transparent)]
40-
SerdeError(#[from] serde_json::Error),
40+
Serde(#[from] serde_json::Error),
4141

4242
#[error("Env value is not valid unicode: {key} = {value:?}")]
4343
EnvValueIsNotValidUnicode { key: Str, value: OsString },
@@ -54,10 +54,10 @@ pub enum Error {
5454
Utf8Error(#[from] bstr::Utf8Error),
5555

5656
#[error(transparent)]
57-
WaxBuildError(#[from] wax::BuildError),
57+
WaxBuild(#[from] wax::BuildError),
5858

5959
#[error(transparent)]
60-
WaxWalkError(#[from] wax::WalkError),
60+
WaxWalk(#[from] wax::WalkError),
6161

6262
#[error("Duplicated task name: {0}")]
6363
DuplicatedTask(Str),
@@ -66,7 +66,7 @@ pub enum Error {
6666
DuplicatedPackageName { name: Str, path1: RelativePathBuf, path2: RelativePathBuf },
6767

6868
#[error("Circular dependency found : {0:?}")]
69-
CycleDependenciesError(petgraph::algo::Cycle<NodeIndex>),
69+
CycleDependencies(petgraph::algo::Cycle<NodeIndex>),
7070

7171
#[error("The package.json name is empty at {0:?}/package.json")]
7272
EmptyPackageName(AbsolutePathBuf),
@@ -93,7 +93,7 @@ pub enum Error {
9393
RecursiveRunWithScope(Str),
9494

9595
#[error(transparent)]
96-
SerdeYmlError(#[from] serde_yml::Error),
96+
SerdeYml(#[from] serde_yml::Error),
9797

9898
#[error("Lint failed, reason: {reason}")]
9999
LintFailed { status: Str, reason: Str },
@@ -102,7 +102,7 @@ pub enum Error {
102102
FmtFailed { status: Str, reason: Str },
103103

104104
#[error("Vite failed")]
105-
ViteError { status: Str, reason: Str },
105+
Vite { status: Str, reason: Str },
106106

107107
#[error("Test failed")]
108108
TestFailed { status: Str, reason: Str },
@@ -119,7 +119,7 @@ pub enum Error {
119119
#[error(
120120
"The stripped path ({stripped_path:?}) is not a valid relative path because: {invalid_path_data_error}"
121121
)]
122-
StripPathError { stripped_path: Box<Path>, invalid_path_data_error: InvalidPathDataError },
122+
StripPath { stripped_path: Box<Path>, invalid_path_data_error: InvalidPathDataError },
123123

124124
#[error("The path ({path:?}) is not a valid relative path because: {reason}")]
125125
InvalidRelativePath { path: Box<Path>, reason: FromPathError },
@@ -142,10 +142,10 @@ pub enum Error {
142142
PackageManagerVersionNotFound { name: Str, version: Str, url: Str },
143143

144144
#[error(transparent)]
145-
SemverError(#[from] semver::Error),
145+
Semver(#[from] semver::Error),
146146

147147
#[error(transparent)]
148-
ReqwestError(#[from] reqwest::Error),
148+
Reqwest(#[from] reqwest::Error),
149149

150150
#[error(transparent)]
151151
JoinError(#[from] tokio::task::JoinError),
@@ -163,12 +163,12 @@ pub enum Error {
163163
UnsupportedHashAlgorithm(Str),
164164

165165
#[error(transparent)]
166-
AnyhowError(#[from] anyhow::Error),
166+
Anyhow(#[from] anyhow::Error),
167167
}
168168

169169
impl From<StripPrefixError<'_>> for Error {
170170
fn from(value: StripPrefixError<'_>) -> Self {
171-
Self::StripPathError {
171+
Self::StripPath {
172172
stripped_path: Box::from(value.stripped_path),
173173
invalid_path_data_error: value.invalid_path_data_error,
174174
}

crates/vite_package_manager/src/package_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ async fn download_package_manager(
469469
download_and_extract_tgz_with_hash(&tgz_url, &target_dir_tmp, expected_hash).await.map_err(
470470
|err| {
471471
// status 404 means the version is not found, convert to PackageManagerVersionNotFound error
472-
if let Error::ReqwestError(e) = &err
472+
if let Error::Reqwest(e) = &err
473473
&& let Some(status) = e.status()
474474
&& status == reqwest::StatusCode::NOT_FOUND
475475
{

crates/vite_task/src/schedule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl ExecutionPlan {
104104
// or the task dependencies declaration is meaningless
105105
let node_indices = match toposort(&task_graph, None) {
106106
Ok(ok) => ok,
107-
Err(err) => return Err(Error::CycleDependenciesError(err)),
107+
Err(err) => return Err(Error::CycleDependencies(err)),
108108
};
109109

110110
// TODO: implement parallel execution grouping

packages/cli/binding/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn js_error_to_fmt_error(err: napi::Error) -> Error {
225225

226226
/// Convert JavaScript errors to Rust vite errors
227227
fn js_error_to_vite_error(err: napi::Error) -> Error {
228-
Error::ViteError { status: err.status.to_string().into(), reason: err.to_string().into() }
228+
Error::Vite { status: err.status.to_string().into(), reason: err.to_string().into() }
229229
}
230230

231231
/// Convert JavaScript errors to Rust test errors

0 commit comments

Comments
 (0)