Fix missing fmt argument in error message (#552)

* Clean up strange non-multiple-of-4 indentation in Source::with_root

* Fix missing fmt argument in error message

* Add changelog entry for PR 552
This commit is contained in:
David Tolnay 2021-11-03 01:03:42 -07:00 committed by GitHub
parent 2c8a425898
commit 325b752144
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -4,6 +4,7 @@
### Unreleased ### Unreleased
- Improve error message from failure in `ethers_contract_abigen::Source::parse` [#552](https://github.com/gakonst/ethers-rs/pull/552)
- use enumerated aliases for overloaded functions [#545](https://github.com/gakonst/ethers-rs/pull/545) - use enumerated aliases for overloaded functions [#545](https://github.com/gakonst/ethers-rs/pull/545)
- move `AbiEncode` `AbiDecode` trait to ethers-core and implement for core types [#531](https://github.com/gakonst/ethers-rs/pull/531) - move `AbiEncode` `AbiDecode` trait to ethers-core and implement for core types [#531](https://github.com/gakonst/ethers-rs/pull/531)
- add `EthCall` trait and derive macro which generates matching structs for contract calls [#517](https://github.com/gakonst/ethers-rs/pull/517) - add `EthCall` trait and derive macro which generates matching structs for contract calls [#517](https://github.com/gakonst/ethers-rs/pull/517)

View File

@ -76,19 +76,19 @@ impl Source {
P: AsRef<Path>, P: AsRef<Path>,
S: AsRef<str>, S: AsRef<str>,
{ {
let root = root.as_ref();
cfg_if! { cfg_if! {
if #[cfg(target_arch = "wasm32")] { if #[cfg(target_arch = "wasm32")] {
let root = root.as_ref();
let root = if root.starts_with("/") { let root = if root.starts_with("/") {
format!("file:://{}", root.display()) format!("file:://{}", root.display())
} else { } else {
format!("{}", root.display()) format!("{}", root.display())
}; };
let base = Url::parse(&root) let base = Url::parse(&root)
.map_err(|_| anyhow!("root path '{}' is not absolute"))?; .map_err(|_| anyhow!("root path '{}' is not absolute", root))?;
} else { } else {
let base = Url::from_directory_path(root) let base = Url::from_directory_path(root)
.map_err(|_| anyhow!("root path '{}' is not absolute"))?; .map_err(|_| anyhow!("root path '{}' is not absolute", root.display()))?;
} }
} }
let url = base.join(source.as_ref())?; let url = base.join(source.as_ref())?;