Skip to content

Commit d7c6b25

Browse files
committed
style: fix clippy::struct_field_names
1 parent 93c15e6 commit d7c6b25

5 files changed

Lines changed: 15 additions & 16 deletions

File tree

crates/vite_package_manager/src/package_manager.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub struct ResolveCommandResult {
5858
/// Then use `PackageManager::resolve_command()` to resolve the command result.
5959
#[derive(Debug)]
6060
pub struct PackageManager {
61-
pub package_manager_type: PackageManagerType,
61+
pub kind: PackageManagerType,
6262
pub package_name: Str,
6363
pub version: Str,
6464
pub hash: Option<Str>,
@@ -69,18 +69,18 @@ pub struct PackageManager {
6969

7070
#[derive(Debug)]
7171
pub struct PackageManagerBuilder {
72-
package_manager_type: Option<PackageManagerType>,
72+
kind_override: Option<PackageManagerType>,
7373
cwd: AbsolutePathBuf,
7474
}
7575

7676
impl PackageManagerBuilder {
7777
pub fn new(cwd: impl AsRef<AbsolutePath>) -> Self {
78-
Self { package_manager_type: None, cwd: cwd.as_ref().to_absolute_path_buf() }
78+
Self { kind_override: None, cwd: cwd.as_ref().to_absolute_path_buf() }
7979
}
8080

8181
#[must_use]
8282
pub const fn package_manager_type(mut self, package_manager_type: PackageManagerType) -> Self {
83-
self.package_manager_type = Some(package_manager_type);
83+
self.kind_override = Some(package_manager_type);
8484
self
8585
}
8686

@@ -89,7 +89,7 @@ impl PackageManagerBuilder {
8989
pub async fn build(self) -> Result<PackageManager, Error> {
9090
let workspace_root = find_workspace_root(&self.cwd)?;
9191
let (package_manager_type, mut version, mut hash) =
92-
get_package_manager_type_and_version(&workspace_root, self.package_manager_type)?;
92+
get_package_manager_type_and_version(&workspace_root, self.kind_override)?;
9393

9494
let mut package_name = package_manager_type.to_string();
9595
let mut should_update_package_manager_field = false;
@@ -125,7 +125,7 @@ impl PackageManagerBuilder {
125125
}
126126

127127
Ok(PackageManager {
128-
package_manager_type,
128+
kind: package_manager_type,
129129
package_name: package_name.into(),
130130
version,
131131
hash,

crates/vite_task/src/config/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl ResolvedTask {
169169
let cwd = &workspace.cwd;
170170
let resolved_task_config =
171171
ResolvedTaskConfig { config_dir: cwd.clone(), config: task_config };
172-
let resolved_envs = TaskEnvs::resolve(&workspace.workspace_dir, &resolved_task_config)?;
172+
let resolved_envs = TaskEnvs::resolve(&workspace.root_dir, &resolved_task_config)?;
173173
let resolved_command = ResolvedTaskCommand {
174174
fingerprint: CommandFingerprint {
175175
cwd: cwd.clone(),

crates/vite_task/src/config/workspace.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::{
2727

2828
#[derive(Debug)]
2929
pub struct Workspace {
30-
pub(crate) workspace_dir: AbsolutePathBuf,
30+
pub(crate) root_dir: AbsolutePathBuf,
3131
pub(crate) cwd: RelativePathBuf,
3232
/// Relative path from workspace root to current package directory.
3333
/// Empty string ("") represents the workspace root package itself.
@@ -112,7 +112,7 @@ impl Workspace {
112112

113113
Ok(Self {
114114
package_graph: Graph::new(),
115-
workspace_dir: workspace_root.to_absolute_path_buf(),
115+
root_dir: workspace_root.to_absolute_path_buf(),
116116
cwd,
117117
current_package_path,
118118
task_cache,
@@ -189,7 +189,7 @@ impl Workspace {
189189

190190
Ok(Self {
191191
package_graph,
192-
workspace_dir: workspace_root.to_absolute_path_buf(),
192+
root_dir: workspace_root.to_absolute_path_buf(),
193193
cwd,
194194
current_package_path,
195195
task_cache,
@@ -208,7 +208,7 @@ impl Workspace {
208208
}
209209

210210
pub async fn unload(self) -> Result<(), Error> {
211-
tracing::debug!("Saving task cache {}", self.workspace_dir.as_path().display());
211+
tracing::debug!("Saving task cache {}", self.root_dir.as_path().display());
212212
self.task_cache.save().await?;
213213
Ok(())
214214
}
@@ -371,9 +371,8 @@ impl Workspace {
371371
if !task_args.is_empty() {
372372
// This is needed for constructing the task run key for caching, so that different args lead to different task runs.
373373
updated_task.args = task_args.clone();
374-
updated_task.resolved_command = updated_task
375-
.resolved_config
376-
.resolve_command(&self.workspace_dir, &task_args)?;
374+
updated_task.resolved_command =
375+
updated_task.resolved_config.resolve_command(&self.root_dir, &task_args)?;
377376
}
378377

379378
// Add to filtered graph

crates/vite_task/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ pub async fn main<
336336
.expect("lint command requires CliOptions to be provided");
337337

338338
let vite_config = read_vite_config_from_workspace_root(
339-
&workspace.workspace_dir,
339+
&workspace.root_dir,
340340
options.as_ref().map(|o| &o.resolve_universal_vite_config),
341341
)
342342
.await?;

crates/vite_task/src/schedule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl ExecutionPlan {
148148
step.clone(),
149149
&workspace.task_cache,
150150
&workspace.fs,
151-
&workspace.workspace_dir,
151+
&workspace.root_dir,
152152
)
153153
.await?;
154154

0 commit comments

Comments
 (0)