diff --git a/app-libs/exchange-oracle/src/coingecko.rs b/app-libs/exchange-oracle/src/coingecko.rs index 4c3fb48d47..d080220924 100644 --- a/app-libs/exchange-oracle/src/coingecko.rs +++ b/app-libs/exchange-oracle/src/coingecko.rs @@ -120,11 +120,7 @@ mod tests { let url = CoinGeckoClient::base_url().unwrap(); let mut coingecko_client = CoinGeckoClient::new(url); let result = coingecko_client.get_exchange_rate("dot", "usd"); - let error = result.unwrap_err(); - if let Error::NoValidData = error { - } else { - assert!(false, "Invalid error kind: {:?}", error); - } + assert_matches!(result, Err(Error::NoValidData)); } #[test] diff --git a/app-libs/exchange-oracle/src/lib.rs b/app-libs/exchange-oracle/src/lib.rs index c7be510620..0f251efaab 100644 --- a/app-libs/exchange-oracle/src/lib.rs +++ b/app-libs/exchange-oracle/src/lib.rs @@ -16,6 +16,7 @@ */ #![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(test, feature(assert_matches))] #[cfg(all(feature = "std", feature = "sgx"))] compile_error!("feature \"std\" and feature \"sgx\" cannot be enabled at the same time");