mirror of
https://github.com/encounter/objdiff.git
synced 2025-12-09 13:37:55 +00:00
Cargo clippy & cargo deny fixes
This commit is contained in:
@@ -67,7 +67,7 @@ fn run_make(cwd: &Path, arg: &Path, config: &AppConfig) -> BuildStatus {
|
||||
let stderr = from_utf8(&output.stderr).context("Failed to process stderr")?;
|
||||
Ok(BuildStatus {
|
||||
success: output.status.code().unwrap_or(-1) == 0,
|
||||
log: format!("{}\n{}", stdout, stderr),
|
||||
log: format!("{stdout}\n{stderr}"),
|
||||
})
|
||||
})() {
|
||||
Ok(status) => status,
|
||||
@@ -102,26 +102,26 @@ fn run_build(
|
||||
|
||||
let total = if config.build_target { 5 } else { 4 };
|
||||
let first_status = if config.build_target {
|
||||
update_status(status, format!("Building target {}", obj_path), 0, total, &cancel)?;
|
||||
update_status(status, format!("Building target {obj_path}"), 0, total, &cancel)?;
|
||||
run_make(project_dir, target_path_rel, &config)
|
||||
} else {
|
||||
BuildStatus { success: true, log: String::new() }
|
||||
};
|
||||
|
||||
update_status(status, format!("Building base {}", obj_path), 1, total, &cancel)?;
|
||||
update_status(status, format!("Building base {obj_path}"), 1, total, &cancel)?;
|
||||
let second_status = run_make(project_dir, base_path_rel, &config);
|
||||
|
||||
let time = OffsetDateTime::now_utc();
|
||||
|
||||
let mut first_obj = if first_status.success {
|
||||
update_status(status, format!("Loading target {}", obj_path), 2, total, &cancel)?;
|
||||
update_status(status, format!("Loading target {obj_path}"), 2, total, &cancel)?;
|
||||
Some(elf::read(&target_path)?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let mut second_obj = if second_status.success {
|
||||
update_status(status, format!("Loading base {}", obj_path), 3, total, &cancel)?;
|
||||
update_status(status, format!("Loading base {obj_path}"), 3, total, &cancel)?;
|
||||
Some(elf::read(&base_path)?)
|
||||
} else {
|
||||
None
|
||||
|
||||
@@ -26,7 +26,7 @@ fn run_update(status: &Status, cancel: Receiver<()>) -> Result<Box<UpdateResult>
|
||||
.assets
|
||||
.iter()
|
||||
.find(|a| a.name == BIN_NAME)
|
||||
.ok_or(anyhow::Error::msg(formatcp!("No release asset for {}", BIN_NAME)))?;
|
||||
.ok_or_else(|| anyhow::Error::msg(formatcp!("No release asset for {}", BIN_NAME)))?;
|
||||
|
||||
update_status(status, "Downloading release".to_string(), 1, 3, &cancel)?;
|
||||
let tmp_dir = tempfile::Builder::new().prefix("update").tempdir_in(current_dir()?)?;
|
||||
@@ -46,7 +46,7 @@ fn run_update(status: &Status, cancel: Receiver<()>) -> Result<Box<UpdateResult>
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let mut perms = fs::metadata(&target_file)?.permissions();
|
||||
perms.set_mode(0755);
|
||||
perms.set_mode(0o755);
|
||||
fs::set_permissions(&target_file, perms)?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user