mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 23:51:05 +00:00
Check docs and run clippy on PRs (#326)
* Check docs, clippy, test run * test parallel CI adapted from other package; is it faster? * Remember to download substrate * Nightly for cargo fmt * Standardise CI names * fix clippy complaints * Ensure docs are valid and export publicly accessible types * all-targets clippy, and fix additional lint errors * newline in ci file
This commit is contained in:
@@ -117,7 +117,7 @@ async fn test_iter() {
|
||||
.await
|
||||
.unwrap();
|
||||
let mut i = 0;
|
||||
while let Some(_) = iter.next().await.unwrap() {
|
||||
while iter.next().await.unwrap().is_some() {
|
||||
i += 1;
|
||||
}
|
||||
assert_eq!(i, 13);
|
||||
|
||||
@@ -51,13 +51,13 @@ async fn tx_basic_transfer() {
|
||||
let alice_pre = api
|
||||
.storage()
|
||||
.system()
|
||||
.account(alice.account_id().clone().into(), None)
|
||||
.account(alice.account_id().clone(), None)
|
||||
.await
|
||||
.unwrap();
|
||||
let bob_pre = api
|
||||
.storage()
|
||||
.system()
|
||||
.account(bob.account_id().clone().into(), None)
|
||||
.account(bob.account_id().clone(), None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -74,7 +74,7 @@ async fn tx_basic_transfer() {
|
||||
.unwrap();
|
||||
let _extrinsic_success = result
|
||||
.find_event::<system::events::ExtrinsicSuccess>()
|
||||
.expect("Failed to decode ExtrinisicSuccess".into())
|
||||
.expect("Failed to decode ExtrinisicSuccess")
|
||||
.expect("Failed to find ExtrinisicSuccess");
|
||||
|
||||
let expected_event = balances::events::Transfer(
|
||||
@@ -87,13 +87,13 @@ async fn tx_basic_transfer() {
|
||||
let alice_post = api
|
||||
.storage()
|
||||
.system()
|
||||
.account(alice.account_id().clone().into(), None)
|
||||
.account(alice.account_id().clone(), None)
|
||||
.await
|
||||
.unwrap();
|
||||
let bob_post = api
|
||||
.storage()
|
||||
.system()
|
||||
.account(bob.account_id().clone().into(), None)
|
||||
.account(bob.account_id().clone(), None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -200,7 +200,7 @@ async fn transfer_subscription() {
|
||||
let cxt = test_context().await;
|
||||
let sub = cxt.client().rpc().subscribe_events().await.unwrap();
|
||||
let decoder = cxt.client().events_decoder();
|
||||
let mut sub = EventSubscription::<DefaultConfig>::new(sub, &decoder);
|
||||
let mut sub = EventSubscription::<DefaultConfig>::new(sub, decoder);
|
||||
sub.filter_event::<balances::events::Transfer>();
|
||||
|
||||
cxt.api
|
||||
|
||||
@@ -56,7 +56,7 @@ impl ContractsTestContext {
|
||||
}
|
||||
|
||||
fn client(&self) -> &Client<DefaultConfig> {
|
||||
&self.cxt.client()
|
||||
self.cxt.client()
|
||||
}
|
||||
|
||||
fn contracts_tx(&self) -> TransactionApi<DefaultConfig> {
|
||||
@@ -172,7 +172,7 @@ async fn tx_instantiate() {
|
||||
let ctx = ContractsTestContext::init().await;
|
||||
let (code_hash, _) = ctx.instantiate_with_code().await.unwrap();
|
||||
|
||||
let instantiated = ctx.instantiate(code_hash.into(), vec![], vec![1u8]).await;
|
||||
let instantiated = ctx.instantiate(code_hash, vec![], vec![1u8]).await;
|
||||
|
||||
assert!(
|
||||
instantiated.is_ok(),
|
||||
|
||||
@@ -32,7 +32,7 @@ type BalancesCall = runtime_types::pallet_balances::pallet::Call;
|
||||
#[async_std::test]
|
||||
async fn test_sudo() {
|
||||
let alice = PairSigner::<DefaultConfig, _>::new(AccountKeyring::Alice.pair());
|
||||
let bob = AccountKeyring::Bob.to_account_id().clone().into();
|
||||
let bob = AccountKeyring::Bob.to_account_id().into();
|
||||
let cxt = test_context().await;
|
||||
|
||||
let call = Call::Balances(BalancesCall::transfer {
|
||||
|
||||
@@ -37,7 +37,7 @@ async fn storage_account() {
|
||||
.api
|
||||
.storage()
|
||||
.system()
|
||||
.account(alice.account_id().clone().into(), None)
|
||||
.account(alice.account_id().clone(), None)
|
||||
.await;
|
||||
assert_matches!(account_info, Ok(_))
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with subxt. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
|
||||
#[subxt::subxt(
|
||||
runtime_metadata_path = "tests/integration/node_runtime.scale",
|
||||
generated_type_derives = "Debug, Eq, PartialEq"
|
||||
|
||||
@@ -72,7 +72,7 @@ where
|
||||
err
|
||||
);
|
||||
log::error!("{}", err);
|
||||
return Err(err.into())
|
||||
return Err(err)
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -132,7 +132,7 @@ impl TestNodeProcessBuilder {
|
||||
|
||||
let ws_port = if self.scan_port_range {
|
||||
let (p2p_port, http_port, ws_port) = next_open_port()
|
||||
.ok_or("No available ports in the given port range".to_owned())?;
|
||||
.ok_or_else(|| "No available ports in the given port range".to_owned())?;
|
||||
|
||||
cmd.arg(format!("--port={}", p2p_port));
|
||||
cmd.arg(format!("--rpc-port={}", http_port));
|
||||
@@ -169,7 +169,7 @@ impl TestNodeProcessBuilder {
|
||||
Err(err) => {
|
||||
if attempts < MAX_ATTEMPTS {
|
||||
attempts += 1;
|
||||
wait_secs = wait_secs * 2; // backoff
|
||||
wait_secs *= 2; // backoff
|
||||
continue
|
||||
}
|
||||
break Err(err)
|
||||
@@ -187,7 +187,7 @@ impl TestNodeProcessBuilder {
|
||||
proc.kill().map_err(|e| {
|
||||
format!("Error killing substrate process '{}': {}", proc.id(), e)
|
||||
})?;
|
||||
Err(err.into())
|
||||
Err(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,14 +216,11 @@ fn next_open_port() -> Option<(u16, u16, u16)> {
|
||||
Ordering::SeqCst,
|
||||
);
|
||||
let next = PORT.fetch_add(1, Ordering::SeqCst);
|
||||
match TcpListener::bind(("0.0.0.0", next)) {
|
||||
Ok(_) => {
|
||||
ports.push(next);
|
||||
if ports.len() == 3 {
|
||||
return Some((ports[0], ports[1], ports[2]))
|
||||
}
|
||||
if TcpListener::bind(("0.0.0.0", next)).is_ok() {
|
||||
ports.push(next);
|
||||
if ports.len() == 3 {
|
||||
return Some((ports[0], ports[1], ports[2]))
|
||||
}
|
||||
Err(_) => (),
|
||||
}
|
||||
ports_scanned += 1;
|
||||
if ports_scanned == MAX_PORTS {
|
||||
|
||||
Reference in New Issue
Block a user