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
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
# nightly regression https://github.com/rust-lang/rust/issues/95267
|
||||
toolchain: nightly-2022-03-20
|
||||
toolchain: nightly
|
||||
profile: minimal
|
||||
components: rustfmt, clippy
|
||||
override: true
|
||||
|
@ -120,9 +119,9 @@ jobs:
|
|||
with:
|
||||
cache-on-failure: true
|
||||
- name: cargo fmt
|
||||
run: cargo +nightly-2022-03-20 fmt --all -- --check
|
||||
run: cargo +nightly fmt --all -- --check
|
||||
- name: cargo clippy
|
||||
run: cargo +nightly-2022-03-20 clippy --all-features -- -D warnings
|
||||
run: cargo +nightly clippy --all-features -- -D warnings
|
||||
|
||||
wasm:
|
||||
name: WASM
|
||||
|
|
|
@ -543,11 +543,11 @@ fn expand_struct_type(struct_ty: &StructFieldType) -> TokenStream {
|
|||
quote! {#ty}
|
||||
}
|
||||
StructFieldType::Array(ty) => {
|
||||
let ty = expand_struct_type(&*ty);
|
||||
let ty = expand_struct_type(ty);
|
||||
quote! {::std::vec::Vec<#ty>}
|
||||
}
|
||||
StructFieldType::FixedArray(ty, size) => {
|
||||
let ty = expand_struct_type(&*ty);
|
||||
let ty = expand_struct_type(ty);
|
||||
quote! { [#ty; #size]}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -782,7 +782,7 @@ mod tests {
|
|||
|
||||
let result = panic::catch_unwind(|| test(&context));
|
||||
|
||||
assert!(result.is_ok())
|
||||
result.unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -207,7 +207,7 @@ mod tests {
|
|||
use ethers_core::abi::Abi;
|
||||
|
||||
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) => {
|
||||
assert!(abi.bytecode.is_some());
|
||||
}
|
||||
|
|
|
@ -214,18 +214,12 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn parse_address_missing_prefix() {
|
||||
assert!(
|
||||
parse_address("0000000000000000000000000000000000000000").is_err(),
|
||||
"parsing address not starting with 0x should fail"
|
||||
);
|
||||
let _ = parse_address("0000000000000000000000000000000000000000").unwrap_err();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_address_address_too_short() {
|
||||
assert!(
|
||||
parse_address("0x00000000000000").is_err(),
|
||||
"parsing address not starting with 0x should fail"
|
||||
);
|
||||
let _ = parse_address("0x00000000000000").unwrap_err();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -70,7 +70,7 @@ pub fn param_type_quote(kind: &ParamType) -> proc_macro2::TokenStream {
|
|||
quote! {#core_crate::abi::ParamType::String}
|
||||
}
|
||||
ParamType::Array(ty) => {
|
||||
let ty = param_type_quote(&*ty);
|
||||
let ty = param_type_quote(ty);
|
||||
quote! {#core_crate::abi::ParamType::Array(Box::new(#ty))}
|
||||
}
|
||||
ParamType::FixedBytes(size) => {
|
||||
|
@ -78,7 +78,7 @@ pub fn param_type_quote(kind: &ParamType) -> proc_macro2::TokenStream {
|
|||
quote! {#core_crate::abi::ParamType::FixedBytes(#size)}
|
||||
}
|
||||
ParamType::FixedArray(ty, size) => {
|
||||
let ty = param_type_quote(&*ty);
|
||||
let ty = param_type_quote(ty);
|
||||
let size = Literal::usize_suffixed(*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> {
|
||||
let factory = ContractFactory::new(abi, bytecode, client);
|
||||
let deployer = factory.deploy("initial value".to_string()).unwrap();
|
||||
assert!(deployer.call().await.is_ok());
|
||||
deployer.call().await.unwrap();
|
||||
deployer.legacy().send().await.unwrap()
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ mod eth_tests {
|
|||
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
|
||||
// clone.
|
||||
assert!(deployer.call().await.is_ok());
|
||||
deployer.call().await.unwrap();
|
||||
let (contract, receipt) = deployer.clone().send_with_receipt().await.unwrap();
|
||||
assert_eq!(receipt.contract_address.unwrap(), contract.address());
|
||||
|
||||
|
|
|
@ -509,7 +509,7 @@ mod tests {
|
|||
]
|
||||
.iter()
|
||||
.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!(U256::try_from(large_positive).unwrap(), large_unsigned);
|
||||
assert!(I256::try_from(U256::MAX).is_err());
|
||||
assert!(U256::try_from(small_negative).is_err());
|
||||
assert!(U256::try_from(large_negative).is_err());
|
||||
I256::try_from(U256::MAX).unwrap_err();
|
||||
U256::try_from(small_negative).unwrap_err();
|
||||
U256::try_from(large_negative).unwrap_err();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -681,7 +681,7 @@ mod tests {
|
|||
None,
|
||||
)
|
||||
.await;
|
||||
assert!(balance.is_ok());
|
||||
balance.unwrap();
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ mod tests {
|
|||
None,
|
||||
)
|
||||
.await;
|
||||
assert!(txs.is_ok());
|
||||
txs.unwrap();
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ mod tests {
|
|||
None,
|
||||
)
|
||||
.await;
|
||||
assert!(txs.is_ok());
|
||||
txs.unwrap();
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
@ -757,7 +757,7 @@ mod tests {
|
|||
None,
|
||||
)
|
||||
.await;
|
||||
assert!(txs.is_ok());
|
||||
txs.unwrap();
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
@ -800,7 +800,7 @@ mod tests {
|
|||
None,
|
||||
)
|
||||
.await;
|
||||
assert!(txs.is_ok());
|
||||
txs.unwrap();
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
@ -820,7 +820,7 @@ mod tests {
|
|||
None,
|
||||
)
|
||||
.await;
|
||||
assert!(txs.is_ok());
|
||||
txs.unwrap();
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
@ -838,7 +838,7 @@ mod tests {
|
|||
None,
|
||||
)
|
||||
.await;
|
||||
assert!(blocks.is_ok());
|
||||
blocks.unwrap();
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
@ -854,6 +854,6 @@ mod tests {
|
|||
let txs = client
|
||||
.get_transactions(&"0x1549ea9b546ba9ffb306d78a1e1f304760cc4abf".parse().unwrap(), None)
|
||||
.await;
|
||||
assert!(txs.is_ok());
|
||||
txs.unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ mod tests {
|
|||
|
||||
let result = client.gas_estimate(2000000000u32.into()).await;
|
||||
|
||||
assert!(result.is_ok());
|
||||
result.unwrap();
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ mod tests {
|
|||
)
|
||||
.await;
|
||||
|
||||
assert!(status.is_ok());
|
||||
status.unwrap();
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ mod tests {
|
|||
)
|
||||
.await;
|
||||
|
||||
assert!(success.is_ok());
|
||||
success.unwrap();
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
|
|
@ -414,7 +414,7 @@ mod tests {
|
|||
let tx = client.sign_transaction(tx).await.unwrap();
|
||||
|
||||
let expected_rlp = Bytes::from(hex::decode("f86b808504e3b29200831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca0080820a95a08290324bae25ca0490077e0d1f4098730333088f6a500793fa420243f35c6b23a06aca42876cd28fdf614a4641e64222fee586391bb3f4061ed5dfefac006be850").unwrap());
|
||||
assert_eq!(tx.clone(), expected_rlp);
|
||||
assert_eq!(tx, expected_rlp);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
|
@ -59,7 +59,7 @@ async fn eth_gas_station() {
|
|||
// initialize and fetch gas estimates from EthGasStation
|
||||
let eth_gas_station_oracle = EthGasStation::default();
|
||||
let data = eth_gas_station_oracle.fetch().await;
|
||||
assert!(data.is_ok());
|
||||
data.unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
@ -71,13 +71,13 @@ async fn etherscan() {
|
|||
// since etherscan does not support `fastest` category, we expect an error
|
||||
let etherscan_oracle = Etherscan::new(etherscan_client.clone()).category(GasCategory::Fastest);
|
||||
let data = etherscan_oracle.fetch().await;
|
||||
assert!(data.is_err());
|
||||
data.unwrap_err();
|
||||
|
||||
// but fetching the `standard` gas price should work fine
|
||||
let etherscan_oracle = Etherscan::new(etherscan_client).category(GasCategory::SafeLow);
|
||||
|
||||
let data = etherscan_oracle.fetch().await;
|
||||
assert!(data.is_ok());
|
||||
data.unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
@ -85,5 +85,5 @@ async fn etherchain() {
|
|||
// initialize and fetch gas estimates from Etherchain
|
||||
let etherchain_oracle = Etherchain::default().category(GasCategory::Fast);
|
||||
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 (_, stream) = mpsc::unbounded();
|
||||
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 signature2 = key2.sign_message(message).await.unwrap();
|
||||
assert_eq!(signature, signature2);
|
||||
assert!(std::fs::remove_file(&path).is_ok());
|
||||
std::fs::remove_file(&path).unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
@ -216,7 +216,7 @@ mod tests {
|
|||
|
||||
let sig = wallet.sign_transaction(&tx).await.unwrap();
|
||||
let sighash = tx.sighash();
|
||||
assert!(sig.verify(sighash, wallet.address).is_ok());
|
||||
sig.verify(sighash, wallet.address).unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
@ -249,7 +249,7 @@ mod tests {
|
|||
let mut tx = tx;
|
||||
tx.set_chain_id(1);
|
||||
let sighash = tx.sighash();
|
||||
assert!(sig.verify(sighash, wallet.address).is_ok());
|
||||
sig.verify(sighash, wallet.address).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -290,7 +290,7 @@ mod tests {
|
|||
let mut tx = tx;
|
||||
tx.set_chain_id(chain_id);
|
||||
let sighash = tx.sighash();
|
||||
assert!(sig.verify(sighash, wallet.address).is_ok());
|
||||
sig.verify(sighash, wallet.address).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -528,7 +528,7 @@ impl CacheEntry {
|
|||
&'a self,
|
||||
version: &'a Version,
|
||||
) -> 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
|
||||
|
|
|
@ -221,7 +221,7 @@ impl FilteredSources {
|
|||
|
||||
/// Returns all dirty files
|
||||
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