diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-10-13 14:27:01 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-10-13 14:27:01 +0800 |
| commit | 4810f56e6a49b60923eb850d5944457650c81c75 (patch) | |
| tree | ef02095c73635b5ace574c26dfcb999017e34897 /crates/vcs_data/src/data/sheet.rs | |
| parent | acf0804b5f9bdc2796d847919a8ae20103be600a (diff) | |
Fix Clippy warnings and optimize code
- Fix let_underscore_future warning by properly awaiting async functions
- Make accept_import function async to match add_mapping usage
- Propagate errors properly with ? operator instead of ignoring them
- Replace manual Default implementation with derive attribute
- Replace vec! with array literal to avoid useless_vec warning
- All tests pass and code is now Clippy clean
Diffstat (limited to 'crates/vcs_data/src/data/sheet.rs')
| -rw-r--r-- | crates/vcs_data/src/data/sheet.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/vcs_data/src/data/sheet.rs b/crates/vcs_data/src/data/sheet.rs index a6220c9..f1cf67c 100644 --- a/crates/vcs_data/src/data/sheet.rs +++ b/crates/vcs_data/src/data/sheet.rs @@ -107,7 +107,7 @@ impl<'a> Sheet<'a> { } /// Accept an input package and insert to the sheet - pub fn accept_import( + pub async fn accept_import( &mut self, input_name: &InputName, insert_to: &SheetPathBuf, @@ -129,7 +129,8 @@ impl<'a> Sheet<'a> { // Insert to sheet for (relative_path, virtual_file_id) in input.files { - let _ = self.add_mapping(insert_to.join(relative_path), virtual_file_id); + self.add_mapping(insert_to.join(relative_path), virtual_file_id) + .await?; } Ok(()) @@ -176,8 +177,7 @@ impl<'a> Sheet<'a> { } Err(_) => { // Error checking rights, don't allow modifying the mapping - Err(std::io::Error::new( - std::io::ErrorKind::Other, + Err(std::io::Error::other( "Failed to check virtual file edit rights", )) } |
