ci: rm pinned nightly (#1541)
* ci: rm pinned nightly * chore(clippy): make clippy happy
This commit is contained in:
parent
b74a38eaad
commit
c75608eda1
|
@ -111,8 +111,7 @@ jobs:
|
||||||
- name: Install toolchain
|
- name: Install toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
# nightly regression https://github.com/rust-lang/rust/issues/95267
|
toolchain: nightly
|
||||||
toolchain: nightly-2022-03-20
|
|
||||||
profile: minimal
|
profile: minimal
|
||||||
components: rustfmt, clippy
|
components: rustfmt, clippy
|
||||||
override: true
|
override: true
|
||||||
|
@ -120,9 +119,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
cache-on-failure: true
|
cache-on-failure: true
|
||||||
- name: cargo fmt
|
- name: cargo fmt
|
||||||
run: cargo +nightly-2022-03-20 fmt --all -- --check
|
run: cargo +nightly fmt --all -- --check
|
||||||
- name: cargo clippy
|
- name: cargo clippy
|
||||||
run: cargo +nightly-2022-03-20 clippy --all-features -- -D warnings
|
run: cargo +nightly clippy --all-features -- -D warnings
|
||||||
|
|
||||||
wasm:
|
wasm:
|
||||||
name: WASM
|
name: WASM
|
||||||
|
|
|
@ -543,11 +543,11 @@ fn expand_struct_type(struct_ty: &StructFieldType) -> TokenStream {
|
||||||
quote! {#ty}
|
quote! {#ty}
|
||||||
}
|
}
|
||||||
StructFieldType::Array(ty) => {
|
StructFieldType::Array(ty) => {
|
||||||
let ty = expand_struct_type(&*ty);
|
let ty = expand_struct_type(ty);
|
||||||
quote! {::std::vec::Vec<#ty>}
|
quote! {::std::vec::Vec<#ty>}
|
||||||
}
|
}
|
||||||
StructFieldType::FixedArray(ty, size) => {
|
StructFieldType::FixedArray(ty, size) => {
|
||||||
let ty = expand_struct_type(&*ty);
|
let ty = expand_struct_type(ty);
|
||||||
quote! { [#ty; #size]}
|
quote! { [#ty; #size]}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -782,7 +782,7 @@ mod tests {
|
||||||
|
|
||||||
let result = panic::catch_unwind(|| test(&context));
|
let result = panic::catch_unwind(|| test(&context));
|
||||||
|
|
||||||
assert!(result.is_ok())
|
result.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -207,7 +207,7 @@ mod tests {
|
||||||
use ethers_core::abi::Abi;
|
use ethers_core::abi::Abi;
|
||||||
|
|
||||||
fn assert_has_bytecode(s: &str) {
|
fn assert_has_bytecode(s: &str) {
|
||||||
match serde_json::from_str::<JsonAbi>(&s).unwrap() {
|
match serde_json::from_str::<JsonAbi>(s).unwrap() {
|
||||||
JsonAbi::Object(abi) => {
|
JsonAbi::Object(abi) => {
|
||||||
assert!(abi.bytecode.is_some());
|
assert!(abi.bytecode.is_some());
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,18 +214,12 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_address_missing_prefix() {
|
fn parse_address_missing_prefix() {
|
||||||
assert!(
|
let _ = parse_address("0000000000000000000000000000000000000000").unwrap_err();
|
||||||
parse_address("0000000000000000000000000000000000000000").is_err(),
|
|
||||||
"parsing address not starting with 0x should fail"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_address_address_too_short() {
|
fn parse_address_address_too_short() {
|
||||||
assert!(
|
let _ = parse_address("0x00000000000000").unwrap_err();
|
||||||
parse_address("0x00000000000000").is_err(),
|
|
||||||
"parsing address not starting with 0x should fail"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -70,7 +70,7 @@ pub fn param_type_quote(kind: &ParamType) -> proc_macro2::TokenStream {
|
||||||
quote! {#core_crate::abi::ParamType::String}
|
quote! {#core_crate::abi::ParamType::String}
|
||||||
}
|
}
|
||||||
ParamType::Array(ty) => {
|
ParamType::Array(ty) => {
|
||||||
let ty = param_type_quote(&*ty);
|
let ty = param_type_quote(ty);
|
||||||
quote! {#core_crate::abi::ParamType::Array(Box::new(#ty))}
|
quote! {#core_crate::abi::ParamType::Array(Box::new(#ty))}
|
||||||
}
|
}
|
||||||
ParamType::FixedBytes(size) => {
|
ParamType::FixedBytes(size) => {
|
||||||
|
@ -78,7 +78,7 @@ pub fn param_type_quote(kind: &ParamType) -> proc_macro2::TokenStream {
|
||||||
quote! {#core_crate::abi::ParamType::FixedBytes(#size)}
|
quote! {#core_crate::abi::ParamType::FixedBytes(#size)}
|
||||||
}
|
}
|
||||||
ParamType::FixedArray(ty, size) => {
|
ParamType::FixedArray(ty, size) => {
|
||||||
let ty = param_type_quote(&*ty);
|
let ty = param_type_quote(ty);
|
||||||
let size = Literal::usize_suffixed(*size);
|
let size = Literal::usize_suffixed(*size);
|
||||||
quote! {#core_crate::abi::ParamType::FixedArray(Box::new(#ty),#size)}
|
quote! {#core_crate::abi::ParamType::FixedArray(Box::new(#ty),#size)}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,6 @@ pub fn connect(anvil: &AnvilInstance, idx: usize) -> Arc<Provider<Http>> {
|
||||||
pub async fn deploy<M: Middleware>(client: Arc<M>, abi: Abi, bytecode: Bytes) -> Contract<M> {
|
pub async fn deploy<M: Middleware>(client: Arc<M>, abi: Abi, bytecode: Bytes) -> Contract<M> {
|
||||||
let factory = ContractFactory::new(abi, bytecode, client);
|
let factory = ContractFactory::new(abi, bytecode, client);
|
||||||
let deployer = factory.deploy("initial value".to_string()).unwrap();
|
let deployer = factory.deploy("initial value".to_string()).unwrap();
|
||||||
assert!(deployer.call().await.is_ok());
|
deployer.call().await.unwrap();
|
||||||
deployer.legacy().send().await.unwrap()
|
deployer.legacy().send().await.unwrap()
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ mod eth_tests {
|
||||||
let deployer = factory.deploy("initial value".to_string()).unwrap().legacy();
|
let deployer = factory.deploy("initial value".to_string()).unwrap().legacy();
|
||||||
// dry runs the deployment of the contract. takes the deployer by reference, no need to
|
// dry runs the deployment of the contract. takes the deployer by reference, no need to
|
||||||
// clone.
|
// clone.
|
||||||
assert!(deployer.call().await.is_ok());
|
deployer.call().await.unwrap();
|
||||||
let (contract, receipt) = deployer.clone().send_with_receipt().await.unwrap();
|
let (contract, receipt) = deployer.clone().send_with_receipt().await.unwrap();
|
||||||
assert_eq!(receipt.contract_address.unwrap(), contract.address());
|
assert_eq!(receipt.contract_address.unwrap(), contract.address());
|
||||||
|
|
||||||
|
|
|
@ -509,7 +509,7 @@ mod tests {
|
||||||
]
|
]
|
||||||
.iter()
|
.iter()
|
||||||
.for_each(|s| {
|
.for_each(|s| {
|
||||||
assert!(parse_mapping(s).is_err());
|
parse_mapping(s).unwrap_err();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1382,9 +1382,9 @@ mod tests {
|
||||||
|
|
||||||
assert_eq!(I256::try_from(large_unsigned).unwrap(), large_positive);
|
assert_eq!(I256::try_from(large_unsigned).unwrap(), large_positive);
|
||||||
assert_eq!(U256::try_from(large_positive).unwrap(), large_unsigned);
|
assert_eq!(U256::try_from(large_positive).unwrap(), large_unsigned);
|
||||||
assert!(I256::try_from(U256::MAX).is_err());
|
I256::try_from(U256::MAX).unwrap_err();
|
||||||
assert!(U256::try_from(small_negative).is_err());
|
U256::try_from(small_negative).unwrap_err();
|
||||||
assert!(U256::try_from(large_negative).is_err());
|
U256::try_from(large_negative).unwrap_err();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -681,7 +681,7 @@ mod tests {
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
assert!(balance.is_ok());
|
balance.unwrap();
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
@ -717,7 +717,7 @@ mod tests {
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
assert!(txs.is_ok());
|
txs.unwrap();
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
@ -736,7 +736,7 @@ mod tests {
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
assert!(txs.is_ok());
|
txs.unwrap();
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
@ -757,7 +757,7 @@ mod tests {
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
assert!(txs.is_ok());
|
txs.unwrap();
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
@ -800,7 +800,7 @@ mod tests {
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
assert!(txs.is_ok());
|
txs.unwrap();
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
@ -820,7 +820,7 @@ mod tests {
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
assert!(txs.is_ok());
|
txs.unwrap();
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
@ -838,7 +838,7 @@ mod tests {
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
assert!(blocks.is_ok());
|
blocks.unwrap();
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
@ -854,6 +854,6 @@ mod tests {
|
||||||
let txs = client
|
let txs = client
|
||||||
.get_transactions(&"0x1549ea9b546ba9ffb306d78a1e1f304760cc4abf".parse().unwrap(), None)
|
.get_transactions(&"0x1549ea9b546ba9ffb306d78a1e1f304760cc4abf".parse().unwrap(), None)
|
||||||
.await;
|
.await;
|
||||||
assert!(txs.is_ok());
|
txs.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ mod tests {
|
||||||
|
|
||||||
let result = client.gas_estimate(2000000000u32.into()).await;
|
let result = client.gas_estimate(2000000000u32.into()).await;
|
||||||
|
|
||||||
assert!(result.is_ok());
|
result.unwrap();
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ mod tests {
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
assert!(status.is_ok());
|
status.unwrap();
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ mod tests {
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
assert!(success.is_ok());
|
success.unwrap();
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
|
@ -414,7 +414,7 @@ mod tests {
|
||||||
let tx = client.sign_transaction(tx).await.unwrap();
|
let tx = client.sign_transaction(tx).await.unwrap();
|
||||||
|
|
||||||
let expected_rlp = Bytes::from(hex::decode("f86b808504e3b29200831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca0080820a95a08290324bae25ca0490077e0d1f4098730333088f6a500793fa420243f35c6b23a06aca42876cd28fdf614a4641e64222fee586391bb3f4061ed5dfefac006be850").unwrap());
|
let expected_rlp = Bytes::from(hex::decode("f86b808504e3b29200831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca0080820a95a08290324bae25ca0490077e0d1f4098730333088f6a500793fa420243f35c6b23a06aca42876cd28fdf614a4641e64222fee586391bb3f4061ed5dfefac006be850").unwrap());
|
||||||
assert_eq!(tx.clone(), expected_rlp);
|
assert_eq!(tx, expected_rlp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
|
@ -59,7 +59,7 @@ async fn eth_gas_station() {
|
||||||
// initialize and fetch gas estimates from EthGasStation
|
// initialize and fetch gas estimates from EthGasStation
|
||||||
let eth_gas_station_oracle = EthGasStation::default();
|
let eth_gas_station_oracle = EthGasStation::default();
|
||||||
let data = eth_gas_station_oracle.fetch().await;
|
let data = eth_gas_station_oracle.fetch().await;
|
||||||
assert!(data.is_ok());
|
data.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -71,13 +71,13 @@ async fn etherscan() {
|
||||||
// since etherscan does not support `fastest` category, we expect an error
|
// since etherscan does not support `fastest` category, we expect an error
|
||||||
let etherscan_oracle = Etherscan::new(etherscan_client.clone()).category(GasCategory::Fastest);
|
let etherscan_oracle = Etherscan::new(etherscan_client.clone()).category(GasCategory::Fastest);
|
||||||
let data = etherscan_oracle.fetch().await;
|
let data = etherscan_oracle.fetch().await;
|
||||||
assert!(data.is_err());
|
data.unwrap_err();
|
||||||
|
|
||||||
// but fetching the `standard` gas price should work fine
|
// but fetching the `standard` gas price should work fine
|
||||||
let etherscan_oracle = Etherscan::new(etherscan_client).category(GasCategory::SafeLow);
|
let etherscan_oracle = Etherscan::new(etherscan_client).category(GasCategory::SafeLow);
|
||||||
|
|
||||||
let data = etherscan_oracle.fetch().await;
|
let data = etherscan_oracle.fetch().await;
|
||||||
assert!(data.is_ok());
|
data.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -85,5 +85,5 @@ async fn etherchain() {
|
||||||
// initialize and fetch gas estimates from Etherchain
|
// initialize and fetch gas estimates from Etherchain
|
||||||
let etherchain_oracle = Etherchain::default().category(GasCategory::Fast);
|
let etherchain_oracle = Etherchain::default().category(GasCategory::Fast);
|
||||||
let data = etherchain_oracle.fetch().await;
|
let data = etherchain_oracle.fetch().await;
|
||||||
assert!(data.is_ok());
|
data.unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -529,6 +529,6 @@ mod tests {
|
||||||
let malformed_data = String::from("not a valid message");
|
let malformed_data = String::from("not a valid message");
|
||||||
let (_, stream) = mpsc::unbounded();
|
let (_, stream) = mpsc::unbounded();
|
||||||
let resp = WsServer::new(ws, stream).handle_text(malformed_data).await;
|
let resp = WsServer::new(ws, stream).handle_text(malformed_data).await;
|
||||||
assert!(resp.is_err(), "Deserialization should not fail silently");
|
resp.unwrap_err();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ mod tests {
|
||||||
let key2 = Wallet::<SigningKey>::decrypt_keystore(&path.clone(), "randpsswd").unwrap();
|
let key2 = Wallet::<SigningKey>::decrypt_keystore(&path.clone(), "randpsswd").unwrap();
|
||||||
let signature2 = key2.sign_message(message).await.unwrap();
|
let signature2 = key2.sign_message(message).await.unwrap();
|
||||||
assert_eq!(signature, signature2);
|
assert_eq!(signature, signature2);
|
||||||
assert!(std::fs::remove_file(&path).is_ok());
|
std::fs::remove_file(&path).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -216,7 +216,7 @@ mod tests {
|
||||||
|
|
||||||
let sig = wallet.sign_transaction(&tx).await.unwrap();
|
let sig = wallet.sign_transaction(&tx).await.unwrap();
|
||||||
let sighash = tx.sighash();
|
let sighash = tx.sighash();
|
||||||
assert!(sig.verify(sighash, wallet.address).is_ok());
|
sig.verify(sighash, wallet.address).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -249,7 +249,7 @@ mod tests {
|
||||||
let mut tx = tx;
|
let mut tx = tx;
|
||||||
tx.set_chain_id(1);
|
tx.set_chain_id(1);
|
||||||
let sighash = tx.sighash();
|
let sighash = tx.sighash();
|
||||||
assert!(sig.verify(sighash, wallet.address).is_ok());
|
sig.verify(sighash, wallet.address).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -290,7 +290,7 @@ mod tests {
|
||||||
let mut tx = tx;
|
let mut tx = tx;
|
||||||
tx.set_chain_id(chain_id);
|
tx.set_chain_id(chain_id);
|
||||||
let sighash = tx.sighash();
|
let sighash = tx.sighash();
|
||||||
assert!(sig.verify(sighash, wallet.address).is_ok());
|
sig.verify(sighash, wallet.address).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -528,7 +528,7 @@ impl CacheEntry {
|
||||||
&'a self,
|
&'a self,
|
||||||
version: &'a Version,
|
version: &'a Version,
|
||||||
) -> impl Iterator<Item = &'a PathBuf> + 'a {
|
) -> impl Iterator<Item = &'a PathBuf> + 'a {
|
||||||
self.artifacts_versions().filter_map(move |(ver, file)| (ver == version).then(|| file))
|
self.artifacts_versions().filter_map(move |(ver, file)| (ver == version).then_some(file))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterator that yields all artifact files
|
/// Iterator that yields all artifact files
|
||||||
|
|
|
@ -221,7 +221,7 @@ impl FilteredSources {
|
||||||
|
|
||||||
/// Returns all dirty files
|
/// Returns all dirty files
|
||||||
pub fn dirty_files(&self) -> impl Iterator<Item = &PathBuf> + fmt::Debug + '_ {
|
pub fn dirty_files(&self) -> impl Iterator<Item = &PathBuf> + fmt::Debug + '_ {
|
||||||
self.0.iter().filter_map(|(k, s)| s.is_dirty().then(|| k))
|
self.0.iter().filter_map(|(k, s)| s.is_dirty().then_some(k))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue