stub: format with rustfmt

This commit is contained in:
nikstur 2023-05-17 21:40:03 +02:00
parent e37bf51ed3
commit 65dbe44999
2 changed files with 9 additions and 5 deletions

View File

@ -4,9 +4,9 @@ use std::os::unix::fs::MetadataExt;
use std::path::{Path, PathBuf};
use anyhow::{anyhow, Context, Result};
use bootspec::BootSpec;
use bootspec::BootJson;
use bootspec::generation::Generation as BootspecGeneration;
use bootspec::BootJson;
use bootspec::BootSpec;
use bootspec::SpecialisationName;
use time::Date;
@ -55,7 +55,7 @@ impl Generation {
// TODO: replace me when https://github.com/DeterminateSystems/bootspec/pull/109 lands.
let bootspec: BootSpec = match boot_json.generation {
BootspecGeneration::V1(bootspec) => bootspec,
_ => return Err(anyhow!("Unsupported bootspec schema"))
_ => return Err(anyhow!("Unsupported bootspec schema")),
};
Ok(Self {
@ -104,7 +104,8 @@ impl fmt::Display for Generation {
}
fn read_build_time(path: &Path) -> Result<Date> {
let build_time = time::OffsetDateTime::from_unix_timestamp(fs::symlink_metadata(path)?.mtime())?.date();
let build_time =
time::OffsetDateTime::from_unix_timestamp(fs::symlink_metadata(path)?.mtime())?.date();
Ok(build_time)
}

View File

@ -26,7 +26,10 @@ impl OsRelease {
// Because the ID field here does not have the same meaning as in a real os-release file,
// it is fine to use a dummy value.
map.insert("ID".into(), String::from("lanza"));
map.insert("PRETTY_NAME".into(), generation.spec.bootspec.bootspec.label.clone());
map.insert(
"PRETTY_NAME".into(),
generation.spec.bootspec.bootspec.label.clone(),
);
map.insert("VERSION_ID".into(), generation.describe());
Ok(Self(map))