Skip to content
Myr

json.rs

This file

Path

src/export/json.rs

27 lines · 637 bytes · Rust

Last changed by

Fix clippy suggestionsDavid Peterbefore adoptionc7e5694

History of this file

Take it

The walk stopped after 200 commits: lines older than 826449b point at it.

Rename to get_command_lineDavid Peterbefore adoption826449b

lines 1–20why, one step back
1use serde::*;
2use serde_json::to_vec_pretty;34use super::Exporter;5use crate::benchmark::benchmark_result::BenchmarkResult;6use crate::util::units::Unit;78use anyhow::Result;910#[derive(Serialize, Debug)]11struct HyperfineSummary<'a> {12 results: &'a [BenchmarkResult],13}1415#[derive(Default)]16pub struct JsonExporter {}1718impl Exporter for JsonExporter {19 fn serialize(&self, results: &[BenchmarkResult], _unit: Option<Unit>) -> Result<Vec<u8>> {20 let mut output = to_vec_pretty(&HyperfineSummary { results });

Fix clippy suggestionsDavid Peterbefore adoptionc7e5694

line 21why, one step back
21 if let Ok(ref mut content) = output {

Rename to get_command_lineDavid Peterbefore adoption826449b

lines 22–27why, one step back
22 content.push(b'\n');
23 }2425 Ok(output?)26 }27}