From 7257ee03975b36cecd535925bb694c6ba3867b18 Mon Sep 17 00:00:00 2001 From: stevenhorsman Date: Tue, 28 Jan 2025 16:12:53 +0000 Subject: [PATCH] agent: Remove implementation of ToString Fix clippy error: ``` direct implementation of `ToString` ``` by switching to implement Display instead Signed-off-by: stevenhorsman --- src/agent/src/util.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/agent/src/util.rs b/src/agent/src/util.rs index 60845a678e..49202c7413 100644 --- a/src/agent/src/util.rs +++ b/src/agent/src/util.rs @@ -181,13 +181,13 @@ mod tests { } } - impl ToString for BufWriter { - fn to_string(&self) -> String { + impl std::fmt::Display for BufWriter { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let data_ref = self.data.clone(); let output = data_ref.lock().unwrap(); let s = (*output).clone(); - String::from_utf8(s).unwrap() + write!(f, "{}", String::from_utf8(s).unwrap()) } }