Clean up format strings.

This commit is contained in:
R-VdP 2023-02-17 13:29:41 +01:00
parent f861aa6d2a
commit 49f30480ea
No known key found for this signature in database
5 changed files with 10 additions and 17 deletions

View file

@ -6,7 +6,7 @@ use anyhow::Result;
use crate::StorePath;
pub fn activate(store_path: StorePath, ephemeral: bool) -> Result<()> {
log::info!("Activating system-manager profile: {}", store_path);
log::info!("Activating system-manager profile: {store_path}");
if ephemeral {
log::info!("Running in ephemeral mode");
}

View file

@ -75,7 +75,7 @@ fn create_etc_link(name: &str, entry: &EtcFile, etc_dir: &Path) -> Result<()> {
etc_dir.join(link_target).as_path(),
)
} else {
anyhow::bail!("Cannot create link for this entry ({}).", name)
anyhow::bail!("Cannot create link for this entry ({name}).")
}
} else {
Ok(())

View file

@ -126,7 +126,7 @@ fn link_services(services: Services, ephemeral: bool) -> Result<LinkedServices>
);
}
Err(e) => {
log::error!("Error linking service {}, skipping.", name);
log::error!("Error linking service {name}, skipping.");
log::error!("{:?}", e);
}
};
@ -227,12 +227,8 @@ where
set
}
Err(e) => {
log::error!(
"Service {}: error {}, please consult the logs",
service,
log_action
);
log::error!("{}", e);
log::error!("Service {service}: error {log_action}, please consult the logs");
log::error!("{e}");
set
}
},

View file

@ -19,7 +19,7 @@ pub fn generate(flake_uri: &str) -> Result<StorePath> {
let profile_dir = Path::new(PROFILE_DIR);
let profile_name = Path::new(PROFILE_NAME);
log::info!("Creating new generation from {}", store_path);
log::info!("Creating new generation from {store_path}");
install_nix_profile(&store_path, profile_dir, profile_name)?;
log::info!("Registering GC root...");
@ -70,7 +70,7 @@ fn get_store_path(nix_build_result: process::Output) -> Result<StorePath> {
String::from_utf8(nix_build_result.stderr)
.map_err(anyhow::Error::from)
.and_then(|e| {
log::error!("{}", e);
log::error!("{e}");
anyhow::bail!("Nix build failed.")
})
}
@ -85,10 +85,7 @@ fn parse_nix_build_output(output: String) -> Result<StorePath> {
if let Some(store_path) = result.outputs.get(expected_output_name) {
return Ok(StorePath::from(store_path.to_owned()));
}
anyhow::bail!(
"No output '{}' found in nix build result.",
expected_output_name
)
anyhow::bail!("No output '{expected_output_name}' found in nix build result.")
}
anyhow::bail!("Multiple build results were returned, we cannot handle that yet.")
}

View file

@ -99,7 +99,7 @@ fn go(action: Action) -> Result<()> {
fn build(flake_uri: String) -> Result<()> {
let store_path = do_build(flake_uri)?;
log::info!("{store_path}");
log::info!("Build system-manager profile {store_path}");
// Print the raw store path to stdout
println!("{store_path}");
Ok(())
@ -130,7 +130,7 @@ fn check_root() -> Result<()> {
fn handle_toplevel_error<T>(r: Result<T>) -> ExitCode {
if let Err(e) = r {
log::error!("{}", e);
log::error!("{e}");
return ExitCode::FAILURE;
}
ExitCode::SUCCESS