Skip to content

Commit

Permalink
Remove string allocation from Display impl for BoltType (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwalker authored Nov 25, 2023
1 parent 65e5ed5 commit 6c9ba46
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@ pub enum BoltType {

impl Display for BoltType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let value = match self {
BoltType::String(s) => s.to_string(),
_ => "to_string not implemented".to_owned(),
};
write!(f, "{}", value)
match self {
BoltType::String(s) => f.write_str(&s.value),
_ => f.write_str("to_string not implemented"),
}
}
}

Expand Down

0 comments on commit 6c9ba46

Please sign in to comment.