From 81f39cd341ea864307f283e2115e3e814f63deda Mon Sep 17 00:00:00 2001 From: Walnut <39544927+Walnut356@users.noreply.github.com> Date: Fri, 6 Oct 2023 04:22:02 -0500 Subject: [PATCH] replaced to_string calls with write macros --- crates/polars-core/src/fmt.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/polars-core/src/fmt.rs b/crates/polars-core/src/fmt.rs index b6b73a4a257b..21a75c81ccaf 100644 --- a/crates/polars-core/src/fmt.rs +++ b/crates/polars-core/src/fmt.rs @@ -1,6 +1,6 @@ #[cfg(any(feature = "fmt", feature = "fmt_no_tty"))] use std::borrow::Cow; -use std::fmt::{Debug, Display, Formatter}; +use std::fmt::{Debug, Display, Formatter, Write}; use std::sync::atomic::{AtomicU8, Ordering}; use std::{fmt, str}; @@ -959,7 +959,7 @@ impl Series { let mut result = "[".to_owned(); for (i, item) in self.iter().enumerate() { - result.push_str(&item.to_string()); + write!(result, "{item}").unwrap(); if i != self.len() - 1 { result.push_str(", "); @@ -967,7 +967,7 @@ impl Series { if i == max_items - 2 { result.push_str("… "); - result.push_str(&self.get(self.len() - 1).unwrap().to_string()); + write!(result, "{}", self.get(self.len() - 1).unwrap()).unwrap(); break; } }