Implement Encoder for Diagnostic manually

...so we can skip serializing `tool_metadata` if it hasn't been set.
This makes the output a bit cleaner, and avoiding having to update a
bunch of unrelated tests.
This commit is contained in:
Jeremy Fitzhardinge 2021-01-18 14:10:31 -08:00
parent 82ccb6582a
commit 50572d6629
12 changed files with 84 additions and 52 deletions

View file

@ -83,6 +83,10 @@ impl ToolMetadata {
fn new(json: Json) -> Self {
ToolMetadata(Some(json))
}
fn is_set(&self) -> bool {
self.0.is_some()
}
}
impl Hash for ToolMetadata {