1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-02 03:12:25 +01:00

Fix clippy suggestions

Leads to a performance improvement for `bat -A`:

    | Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
    |:---|---:|---:|---:|---:|
    | `./bat-master --no-config -A ./bat-master` | 259.8 ± 1.1 | 258.4 | 261.7 | 1.15 ± 0.01 |
    | `./bat-2301 --no-config -A ./bat-master` | 225.6 ± 1.8 | 224.0 | 229.5 | 1.00 |
This commit is contained in:
David Peter
2022-09-04 00:02:08 +02:00
committed by David Peter
parent eab1c9eb46
commit 48541b8507
8 changed files with 15 additions and 11 deletions

View File

@@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
use crate::error::*;
#[derive(Debug, PartialEq, Default, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct AssetsMetadata {
bat_version: Option<String>,
creation_time: Option<SystemTime>,

View File

@@ -1,3 +1,4 @@
use std::fmt::Write;
use std::fs::read_to_string;
use std::path::{Path, PathBuf};
@@ -124,7 +125,7 @@ fn append_to_acknowledgements(
relative_path: &str,
license_text: &str,
) {
acknowledgements.push_str(&format!("## {}\n\n{}", relative_path, license_text));
write!(acknowledgements, "## {}\n\n{}", relative_path, license_text).ok();
// Make sure the last char is a newline to not mess up formatting later
if acknowledgements