From a41ae901e58fbe45e5ec037d57f6e75a85ef1cc9 Mon Sep 17 00:00:00 2001 From: Clifton King Date: Tue, 31 May 2022 11:44:24 -0500 Subject: [PATCH] fix(abigen): non-snake-case modules out of order (#1331) eg: `console` and `shared_types` were out of order and would fail rustfmt check --- ethers-contract/ethers-contract-abigen/src/multi.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ethers-contract/ethers-contract-abigen/src/multi.rs b/ethers-contract/ethers-contract-abigen/src/multi.rs index 3a87fb9e..594a5797 100644 --- a/ethers-contract/ethers-contract-abigen/src/multi.rs +++ b/ethers-contract/ethers-contract-abigen/src/multi.rs @@ -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)?; }