Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions fearless_simd_gen/src/main.rs
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file contains an improvement to an expect message that would otherwise literally panic with the message: "error parsing {name}". Now it provides the name.

Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ impl Module {
}
}

fn generate_string(self) -> String {
fn generate_string(self, name: &str) -> String {
let code = self.generate_code();
let parsed = syn::parse_file(&code.to_string()).expect("error parsing {name}");
let parsed = syn::parse_file(&code.to_string()).expect(&format!("error parsing {name}"));
let code_str = prettyplease::unparse(&parsed);
format!("// This file is autogenerated by fearless_simd_gen\n\n{code_str}")
}
Expand Down Expand Up @@ -101,7 +101,7 @@ fn main() {
let name = module.file_base();
let path = base_dir.join(format!("{name}.rs"));
let file = File::create(&path).expect("error creating {path:?}");
let code_str = module.generate_string();
let code_str = module.generate_string(name);
write_formatted(code_str.as_bytes(), file);
}
}
Expand Down
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
edition = "2024"
Loading