stub: format with rustfmt
This commit is contained in:
parent
e37bf51ed3
commit
65dbe44999
|
@ -4,9 +4,9 @@ use std::os::unix::fs::MetadataExt;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use anyhow::{anyhow, Context, Result};
|
use anyhow::{anyhow, Context, Result};
|
||||||
use bootspec::BootSpec;
|
|
||||||
use bootspec::BootJson;
|
|
||||||
use bootspec::generation::Generation as BootspecGeneration;
|
use bootspec::generation::Generation as BootspecGeneration;
|
||||||
|
use bootspec::BootJson;
|
||||||
|
use bootspec::BootSpec;
|
||||||
use bootspec::SpecialisationName;
|
use bootspec::SpecialisationName;
|
||||||
use time::Date;
|
use time::Date;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ impl Generation {
|
||||||
// TODO: replace me when https://github.com/DeterminateSystems/bootspec/pull/109 lands.
|
// TODO: replace me when https://github.com/DeterminateSystems/bootspec/pull/109 lands.
|
||||||
let bootspec: BootSpec = match boot_json.generation {
|
let bootspec: BootSpec = match boot_json.generation {
|
||||||
BootspecGeneration::V1(bootspec) => bootspec,
|
BootspecGeneration::V1(bootspec) => bootspec,
|
||||||
_ => return Err(anyhow!("Unsupported bootspec schema"))
|
_ => return Err(anyhow!("Unsupported bootspec schema")),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
|
@ -104,7 +104,8 @@ impl fmt::Display for Generation {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_build_time(path: &Path) -> Result<Date> {
|
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)
|
Ok(build_time)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,10 @@ impl OsRelease {
|
||||||
// Because the ID field here does not have the same meaning as in a real os-release file,
|
// 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.
|
// it is fine to use a dummy value.
|
||||||
map.insert("ID".into(), String::from("lanza"));
|
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());
|
map.insert("VERSION_ID".into(), generation.describe());
|
||||||
|
|
||||||
Ok(Self(map))
|
Ok(Self(map))
|
||||||
|
|
Loading…
Reference in New Issue