Skip to content

Commit 6c9ba46

Browse files
authored
Remove string allocation from Display impl for BoltType (#152)
1 parent 65e5ed5 commit 6c9ba46

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/src/types.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,10 @@ pub enum BoltType {
6868

6969
impl Display for BoltType {
7070
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
71-
let value = match self {
72-
BoltType::String(s) => s.to_string(),
73-
_ => "to_string not implemented".to_owned(),
74-
};
75-
write!(f, "{}", value)
71+
match self {
72+
BoltType::String(s) => f.write_str(&s.value),
73+
_ => f.write_str("to_string not implemented"),
74+
}
7675
}
7776
}
7877

0 commit comments

Comments
 (0)