Skip to content

Commit 6e2fb4a

Browse files
committed
fix: clippy
1 parent 5047cc6 commit 6e2fb4a

File tree

1 file changed

+30
-36
lines changed

1 file changed

+30
-36
lines changed

crates/tools/dev/src/main.rs

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -72,43 +72,37 @@ fn build(target: &str) {
7272
);
7373

7474
if env::var("GITHUB_ACTIONS").is_ok() {
75-
match env::var("GITHUB_OUTPUT") {
76-
Ok(output) => {
77-
let windows_path = Path::new("target")
78-
.join(target)
79-
.join("release")
80-
.join("kill_tree_cli.exe");
81-
let file_path = if windows_path.exists() {
82-
windows_path
83-
} else {
84-
Path::new("target")
85-
.join(target)
86-
.join("release")
87-
.join("kill_tree_cli")
88-
};
89-
let zip_path = format!("{}.zip", target);
90-
let zip_file = std::fs::File::create(zip_path.clone()).unwrap();
91-
let mut zip = zip::ZipWriter::new(zip_file);
92-
let options = zip::write::FileOptions::default()
93-
.compression_method(zip::CompressionMethod::Stored)
94-
.unix_permissions(0o755);
95-
let file_name = file_path.file_name().unwrap().to_str().unwrap();
96-
zip.start_file(file_name, options).unwrap();
97-
let mut file = std::fs::File::open(file_path).unwrap();
98-
std::io::copy(&mut file, &mut zip).unwrap();
99-
zip.finish().unwrap();
75+
let output = env::var("GITHUB_OUTPUT").expect("No GITHUB_OUTPUT");
76+
let windows_path = Path::new("target")
77+
.join(target)
78+
.join("release")
79+
.join("kill_tree_cli.exe");
80+
let file_path = if windows_path.exists() {
81+
windows_path
82+
} else {
83+
Path::new("target")
84+
.join(target)
85+
.join("release")
86+
.join("kill_tree_cli")
87+
};
88+
let zip_path = format!("{target}.zip");
89+
let zip_file = std::fs::File::create(zip_path.clone()).unwrap();
90+
let mut zip = zip::ZipWriter::new(zip_file);
91+
let options = zip::write::FileOptions::default()
92+
.compression_method(zip::CompressionMethod::Stored)
93+
.unix_permissions(0o755);
94+
let file_name = file_path.file_name().unwrap().to_str().unwrap();
95+
zip.start_file(file_name, options).unwrap();
96+
let mut file = std::fs::File::open(file_path).unwrap();
97+
std::io::copy(&mut file, &mut zip).unwrap();
98+
zip.finish().unwrap();
10099

101-
let mut output_path = std::fs::OpenOptions::new()
102-
.write(true)
103-
.append(true)
104-
.open(output)
105-
.unwrap();
106-
writeln!(output_path, "ARTIFACT_PATH={}", zip_path).unwrap();
107-
}
108-
Err(_) => {
109-
panic!("No GITHUB_OUTPUT");
110-
}
111-
}
100+
let mut output_path = std::fs::OpenOptions::new()
101+
.write(true)
102+
.append(true)
103+
.open(output)
104+
.unwrap();
105+
writeln!(output_path, "ARTIFACT_PATH={zip_path}").unwrap();
112106
}
113107
}
114108

0 commit comments

Comments
 (0)