Skip to content

Commit 9a18110

Browse files
committed
simplify testing proc-macro
1 parent c8a8b04 commit 9a18110

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

test/unit/extra_outdirs/proc_macro.rs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,15 @@ use std::path::PathBuf;
88

99
#[proc_macro]
1010
pub fn write_to_outdirs(_item: TokenStream) -> TokenStream {
11-
// Read the list of directories to write to from an environment variable
12-
let outdirs = env::var("EXTRA_OUTDIRS")
13-
.expect("EXTRA_OUTDIRS environment variable must be set");
14-
1511
// Read the output directory paths from Bazel
1612
// Format: EXTRA_OUTDIRS_PATHS=dir1:path1,dir2:path2
1713
let outdirs_paths = env::var("EXTRA_OUTDIRS_PATHS")
1814
.expect("EXTRA_OUTDIRS_PATHS environment variable must be set");
1915

20-
// Create a map of directory name to output path
21-
let mut path_map = std::collections::HashMap::new();
22-
for entry in outdirs_paths.split(',') {
23-
if let Some((dir, path)) = entry.split_once(':') {
24-
path_map.insert(dir.trim(), path.trim());
25-
}
26-
}
27-
2816
// Write to the output directories declared by Bazel
29-
for dir in outdirs.split(',') {
30-
let dir = dir.trim();
31-
if !dir.is_empty() {
32-
// Get the output path for this directory
33-
let dir_path = if let Some(path) = path_map.get(dir) {
34-
PathBuf::from(path)
35-
} else {
36-
// Fallback to directory name if path not found
37-
PathBuf::from(dir)
38-
};
17+
for entry in outdirs_paths.split(',') {
18+
if let Some((_dir, path)) = entry.split_once(':') {
19+
let dir_path = PathBuf::from(path.trim());
3920

4021
// Create the directory if it doesn't exist
4122
if let Err(e) = fs::create_dir_all(&dir_path) {

0 commit comments

Comments
 (0)