feat: update finalize to return Result<()> and simplify save mode

Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-18 08:12:49 -03:00
parent f11070dc60
commit 22206de5ab
5 changed files with 43 additions and 105 deletions

View File

@@ -114,15 +114,14 @@ impl MetaPlugin for MagicFileMetaPlugin {
Ok(())
}
fn finalize(&mut self) -> io::Result<String> {
fn finalize(&mut self) -> Result<()> {
// Save all magic metadata if not already saved
if !self.is_saved {
if let Err(e) = self.save_all_magic_metadata() {
eprintln!("Warning: Failed to save magic metadata: {}", e);
}
}
// Return empty string since we save during finalize or update
Ok("".to_string())
Ok(())
}
fn update(&mut self, data: &[u8]) {