diff options
author | Chris Wailes <chriswailes@google.com> | 2024-05-09 15:24:18 -0700 |
---|---|---|
committer | Chris Wailes <chriswailes@google.com> | 2024-05-09 22:40:52 +0000 |
commit | 6a5bd3840211dc2a8f8c7aa9ad79a839c159f14a (patch) | |
tree | 603317addacfca8917ab528e008338c2348af9c3 | |
parent | 14be9dd102f0128c2fce8068e8bd350d05e5e26e (diff) | |
download | extras-6a5bd3840211dc2a8f8c7aa9ad79a839c159f14a.tar.gz |
Replace impl ToString with impl Display
If the Display interface is implemented the compiler will automatically
derive an implementation of ToString.
Test: m rust
Bug: 333887339
Change-Id: Ib07011b5004bdc42b60eff7405528b72e77b9496
-rw-r--r-- | profcollectd/libprofcollectd/config.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/profcollectd/libprofcollectd/config.rs b/profcollectd/libprofcollectd/config.rs index af714242..cdf14879 100644 --- a/profcollectd/libprofcollectd/config.rs +++ b/profcollectd/libprofcollectd/config.rs @@ -82,9 +82,9 @@ impl Config { } } -impl ToString for Config { - fn to_string(&self) -> String { - serde_json::to_string(self).expect("Failed to deserialise configuration.") +impl std::fmt::Display for Config { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", serde_json::to_string(self).expect("Failed to deserialise configuration.")) } } |