summaryrefslogtreecommitdiff
path: root/legacy_actions/src/remote_actions
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-03-20 21:54:29 +0800
committer魏曹先生 <1992414357@qq.com>2026-03-20 21:57:49 +0800
commit9a60751a901f568bdeb154c4115235d4f3a0f8b9 (patch)
tree65df323f6478bae51473a3d6471df39a596ce9c5 /legacy_actions/src/remote_actions
parenta9e5c086584d3e697188be7003f564e7e2137135 (diff)
Apply clippy suggestions and improve code quality
Diffstat (limited to 'legacy_actions/src/remote_actions')
-rw-r--r--legacy_actions/src/remote_actions/content_manage/track_file.rs8
-rw-r--r--legacy_actions/src/remote_actions/mapping_manage/merge_share_mapping.rs7
-rw-r--r--legacy_actions/src/remote_actions/workspace_manage/update_to_latest_info.rs9
3 files changed, 10 insertions, 14 deletions
diff --git a/legacy_actions/src/remote_actions/content_manage/track_file.rs b/legacy_actions/src/remote_actions/content_manage/track_file.rs
index a59ca76..0beb348 100644
--- a/legacy_actions/src/remote_actions/content_manage/track_file.rs
+++ b/legacy_actions/src/remote_actions/content_manage/track_file.rs
@@ -437,7 +437,7 @@ async fn proc_create_tasks_local(
let mut mut_instance = instance.lock().await;
let mut local_sheet = workspace.local_sheet(member_id, sheet_name).await?;
- if print_infos && relative_paths.len() > 0 {
+ if print_infos && !relative_paths.is_empty() {
local_println!(local_output, "Creating {} files...", relative_paths.len());
}
@@ -585,7 +585,7 @@ async fn proc_update_tasks_local(
let mut success = Vec::new();
- if print_infos && relative_paths.len() > 0 {
+ if print_infos && !relative_paths.is_empty() {
local_println!(local_output, "Updating {} files...", relative_paths.len());
}
@@ -826,7 +826,7 @@ async fn proc_sync_tasks_local(
let mut mut_instance = instance.lock().await;
let mut success: Vec<PathBuf> = Vec::new();
- if print_infos && relative_paths.len() > 0 {
+ if print_infos && !relative_paths.is_empty() {
local_println!(local_output, "Syncing {} files...", relative_paths.len());
}
@@ -902,7 +902,7 @@ async fn proc_sync_tasks_local(
// First download
let mut data = LocalMappingMetadata::default();
data.set_mapping_vfid(vfid);
- if let Err(_) = local_sheet.add_mapping(&path, data) {
+ if local_sheet.add_mapping(&path, data).is_err() {
continue;
}
match local_sheet.mapping_data_mut(&path) {
diff --git a/legacy_actions/src/remote_actions/mapping_manage/merge_share_mapping.rs b/legacy_actions/src/remote_actions/mapping_manage/merge_share_mapping.rs
index df889a1..d3485cb 100644
--- a/legacy_actions/src/remote_actions/mapping_manage/merge_share_mapping.rs
+++ b/legacy_actions/src/remote_actions/mapping_manage/merge_share_mapping.rs
@@ -104,11 +104,8 @@ pub async fn merge_share_mapping_action(
.await
.read::<MergeShareMappingActionResult>()
.await?;
- match result {
- MergeShareMappingActionResult::Success => {
- sign_vault_modified(true).await;
- }
- _ => {}
+ if let MergeShareMappingActionResult::Success = result {
+ sign_vault_modified(true).await;
}
return Ok(result);
}
diff --git a/legacy_actions/src/remote_actions/workspace_manage/update_to_latest_info.rs b/legacy_actions/src/remote_actions/workspace_manage/update_to_latest_info.rs
index cd17c32..7ff2c49 100644
--- a/legacy_actions/src/remote_actions/workspace_manage/update_to_latest_info.rs
+++ b/legacy_actions/src/remote_actions/workspace_manage/update_to_latest_info.rs
@@ -80,8 +80,8 @@ pub async fn update_to_latest_info_action(
for sheet in vault.sheets().await? {
// Build share parts
- if let Some(holder) = sheet.holder() {
- if holder == &member_id || holder == VAULT_HOST_NAME {
+ if let Some(holder) = sheet.holder()
+ && (holder == &member_id || holder == VAULT_HOST_NAME) {
let mut sheet_shares: HashMap<SheetShareId, Share> = HashMap::new();
for share in sheet.get_shares().await? {
// Get SharePath
@@ -99,11 +99,10 @@ pub async fn update_to_latest_info_action(
}
shares_in_my_sheets.insert(sheet.name().clone(), sheet_shares);
}
- }
// Build sheet parts
let holder_is_host =
- sheet.holder().unwrap_or(&String::default()) == &VAULT_HOST_NAME;
+ sheet.holder().unwrap_or(&String::default()) == VAULT_HOST_NAME;
if sheet.holder().is_some()
&& (sheet.holder().unwrap() == &member_id || holder_is_host)
{
@@ -129,7 +128,7 @@ pub async fn update_to_latest_info_action(
latest_info.ref_sheet_content = ref_sheet_data.clone();
latest_info.ref_sheet_vfs_mapping = ref_sheet_data
.mapping()
- .into_iter()
+ .iter()
.map(|(path, file)| (file.id.clone(), path.clone()))
.collect::<HashMap<VirtualFileId, SheetPathBuf>>();
latest_info.reference_sheets = ref_sheets;