fix(abigen): make compatible with older rust versions (#1868)

* fix(abigen): make compatible with older rust versions

* Update ethers-contract/ethers-contract-abigen/src/multi.rs

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>

* fix: linting

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Will Smith 2022-11-17 13:43:41 -05:00 committed by GitHub
parent 0e51835a33
commit a525659f5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -575,9 +575,11 @@ impl MultiBindingsInner {
let data = std::fs::read_to_string(cargo_dir)?;
let toml = data.parse::<Value>()?;
let Some(ethers) = toml.get("dependencies")
.and_then (|v| v.get("ethers").or_else(|| v.get("ethers-contract")))
else { eyre::bail!("couldn't find ethers or ethers-contract dependency")};
let ethers = toml
.get("dependencies")
.and_then(|v| v.get("ethers").or_else(|| v.get("ethers-contract")))
.ok_or_else(|| eyre::eyre!("couldn't find ethers or ethers-contract dependency"))?;
if let Some(rev) = ethers.get("rev") {
Ok(format!("ethers = {{ git = \"https://github.com/gakonst/ethers-rs\", rev = {}, default-features = false, features = [\"abigen\"] }}", rev))
} else if let Some(version) = ethers.get("version") {