refactor: remove unused create() method from MetaPlugin trait
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -49,7 +49,6 @@ pub trait MetaPlugin {
|
||||
false
|
||||
}
|
||||
|
||||
fn create(&self) -> Result<Box<dyn Write>>;
|
||||
fn finalize(&mut self) -> io::Result<String>;
|
||||
|
||||
// Update the meta plugin with new data
|
||||
|
||||
@@ -26,12 +26,6 @@ impl MetaPlugin for DigestSha256MetaPlugin {
|
||||
true
|
||||
}
|
||||
|
||||
fn create(&self) -> Result<Box<dyn Write>> {
|
||||
// For meta plugins, we don't actually create a writer since we're buffering data internally
|
||||
// This method is required by the trait but not used in the same way as digest engines
|
||||
Ok(Box::new(DummyWriter))
|
||||
}
|
||||
|
||||
fn finalize(&mut self) -> io::Result<String> {
|
||||
let result = self.hasher.clone().finalize();
|
||||
Ok(format!("{:x}", result))
|
||||
@@ -46,19 +40,6 @@ impl MetaPlugin for DigestSha256MetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
// Dummy writer that implements Write but doesn't do anything
|
||||
// This is needed to satisfy the MetaPlugin trait requirements
|
||||
struct DummyWriter;
|
||||
|
||||
impl Write for DummyWriter {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
Ok(buf.len())
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct ReadTimeMetaPlugin {
|
||||
@@ -80,11 +61,6 @@ impl MetaPlugin for ReadTimeMetaPlugin {
|
||||
true
|
||||
}
|
||||
|
||||
fn create(&self) -> Result<Box<dyn Write>> {
|
||||
// For meta plugins, we don't actually create a writer since we're buffering data internally
|
||||
Ok(Box::new(DummyWriter))
|
||||
}
|
||||
|
||||
fn finalize(&mut self) -> io::Result<String> {
|
||||
if let Some(start_time) = self.start_time {
|
||||
let duration = start_time.elapsed();
|
||||
@@ -127,11 +103,6 @@ impl MetaPlugin for ReadRateMetaPlugin {
|
||||
true
|
||||
}
|
||||
|
||||
fn create(&self) -> Result<Box<dyn Write>> {
|
||||
// For meta plugins, we don't actually create a writer since we're buffering data internally
|
||||
Ok(Box::new(DummyWriter))
|
||||
}
|
||||
|
||||
fn finalize(&mut self) -> io::Result<String> {
|
||||
if let Some(start_time) = self.start_time {
|
||||
let duration = start_time.elapsed();
|
||||
|
||||
Reference in New Issue
Block a user