summaryrefslogtreecommitdiff
path: root/crates/vcs_data/src/data/local/local_files.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-11-23 15:16:55 +0800
committer魏曹先生 <1992414357@qq.com>2025-11-23 15:16:55 +0800
commitc1a50fbdddc5fad986f4b3b6310cc5167e68f87e (patch)
treea7b8b62691a0eefdffd5e25f59941c12a70efb04 /crates/vcs_data/src/data/local/local_files.rs
parentbe76a48b6b53756fe1ba2f2ddd44bc14c9eb35bb (diff)
Apply clippy suggestions
Diffstat (limited to 'crates/vcs_data/src/data/local/local_files.rs')
-rw-r--r--crates/vcs_data/src/data/local/local_files.rs21
1 files changed, 7 insertions, 14 deletions
diff --git a/crates/vcs_data/src/data/local/local_files.rs b/crates/vcs_data/src/data/local/local_files.rs
index 8444f97..9cc244f 100644
--- a/crates/vcs_data/src/data/local/local_files.rs
+++ b/crates/vcs_data/src/data/local/local_files.rs
@@ -1,4 +1,4 @@
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
use string_proc::format_path::format_path;
use tokio::fs;
@@ -25,16 +25,13 @@ impl RelativeFiles {
}
/// Read the relative paths within the project from the input file list
-pub async fn get_relative_paths(
- local_path: &PathBuf,
- paths: &Vec<PathBuf>,
-) -> Option<RelativeFiles> {
+pub async fn get_relative_paths(local_path: &PathBuf, paths: &[PathBuf]) -> Option<RelativeFiles> {
// Get Relative Paths
- let Ok(paths) = format_input_paths_and_ignore_outside_paths(&local_path, &paths).await else {
+ let Ok(paths) = format_input_paths_and_ignore_outside_paths(local_path, paths).await else {
return None;
};
let files: Vec<PathBuf> = abs_paths_to_abs_files(paths).await;
- let Ok(files) = parse_to_relative(&local_path, files) else {
+ let Ok(files) = parse_to_relative(local_path, files) else {
return None;
};
Some(RelativeFiles { files })
@@ -42,7 +39,7 @@ pub async fn get_relative_paths(
/// Normalize the input paths
async fn format_input_paths(
- local_path: &PathBuf,
+ local_path: &Path,
track_files: &[PathBuf],
) -> Result<Vec<PathBuf>, std::io::Error> {
let current_dir = local_path;
@@ -54,8 +51,7 @@ async fn format_input_paths(
// Skip paths that contain .jv directories
if path.components().any(|component| {
if let std::path::Component::Normal(name) = component {
- name.to_str()
- .map_or(false, |s| s == CLIENT_FOLDER_WORKSPACE_ROOT_NAME)
+ name.to_str() == Some(CLIENT_FOLDER_WORKSPACE_ROOT_NAME)
} else {
false
}
@@ -109,10 +105,7 @@ fn parse_to_relative(
})
.collect();
- match result {
- Ok(paths) => Ok(paths),
- Err(e) => Err(e),
- }
+ result
}
/// Convert absolute paths to absolute file paths, expanding directories to their contained files