fix(abigen): non-snake-case modules out of order (#1331)

eg: `console` and `shared_types` were out of order and would fail
rustfmt check
This commit is contained in:
Clifton King 2022-05-31 11:44:24 -05:00 committed by GitHub
parent 6a45a93685
commit a41ae901e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -558,13 +558,13 @@ serde_json = "1.0.79"
/// Append module declarations to the `lib.rs` or `mod.rs`
fn append_module_names(&self, mut buf: impl Write) -> Result<()> {
let mut mod_names: BTreeSet<_> = self.bindings.keys().collect();
let mut mod_names: BTreeSet<_> =
self.bindings.keys().map(|name| name.to_snake_case()).collect();
if let Some(ref shared) = self.shared_types {
mod_names.insert(&shared.name);
mod_names.insert(shared.name.to_snake_case());
}
for module in mod_names.into_iter().map(|name| format!("pub mod {};", name.to_snake_case()))
{
for module in mod_names.into_iter().map(|name| format!("pub mod {};", name)) {
writeln!(buf, "{}", module)?;
}