Skip to content

Commit 4770a44

Browse files
eordanoclaude
andcommitted
fix: rustfmt and clippy compliance
Wrap the let-else per rustfmt. Replace set_readonly(false) with an explicit owner-write mode bit on unix (permissions_set_readonly_false is denied by CI clippy). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent bad4371 commit 4770a44

2 files changed

Lines changed: 22 additions & 13 deletions

File tree

crate/src/lodgen/pipeline.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,12 @@ pub fn acquire_placements(
109109
PathBuf::from(home).join(".cache/abgen-lod/manifest-builder")
110110
}
111111
};
112-
let Some(manifest_path) =
113-
placements::run_manifest_builder(
114-
&run_coords,
115-
Path::new(&tool_dir),
116-
&work_dir,
117-
catalyst,
118-
)?
112+
let Some(manifest_path) = placements::run_manifest_builder(
113+
&run_coords,
114+
Path::new(&tool_dir),
115+
&work_dir,
116+
catalyst,
117+
)?
119118
else {
120119
eprintln!(
121120
"manifest-builder: scene ran to completion but emitted no manifest \

crate/src/lodgen/placements_native.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ pub fn fetch_iss(scene_id: &str) -> Result<Option<Vec<u8>>> {
2525
}
2626
}
2727

28+
fn writable(mut perms: std::fs::Permissions) -> std::fs::Permissions {
29+
#[cfg(unix)]
30+
{
31+
use std::os::unix::fs::PermissionsExt;
32+
perms.set_mode(perms.mode() | 0o200);
33+
}
34+
#[cfg(not(unix))]
35+
#[allow(clippy::permissions_set_readonly_false)]
36+
perms.set_readonly(false);
37+
perms
38+
}
39+
2840
fn copy_tree(src: &Path, dst: &Path) -> Result<()> {
2941
std::fs::create_dir_all(dst).with_context(|| format!("mkdir {}", dst.display()))?;
3042
for entry in std::fs::read_dir(src).with_context(|| format!("read dir {}", src.display()))? {
@@ -40,20 +52,18 @@ fn copy_tree(src: &Path, dst: &Path) -> Result<()> {
4052
copy_tree(&sp, &dp)?;
4153
} else {
4254
if let Ok(meta) = std::fs::metadata(&dp) {
43-
let mut perms = meta.permissions();
55+
let perms = meta.permissions();
4456
if perms.readonly() {
45-
perms.set_readonly(false);
46-
let _ = std::fs::set_permissions(&dp, perms);
57+
let _ = std::fs::set_permissions(&dp, writable(perms));
4758
}
4859
}
4960
std::fs::copy(&sp, &dp)
5061
.with_context(|| format!("copy {} -> {}", sp.display(), dp.display()))?;
51-
let mut perms = std::fs::metadata(&dp)
62+
let perms = std::fs::metadata(&dp)
5263
.with_context(|| format!("stat {}", dp.display()))?
5364
.permissions();
5465
if perms.readonly() {
55-
perms.set_readonly(false);
56-
std::fs::set_permissions(&dp, perms)
66+
std::fs::set_permissions(&dp, writable(perms))
5767
.with_context(|| format!("chmod {}", dp.display()))?;
5868
}
5969
}

0 commit comments

Comments
 (0)