Remove unneeded Config bounds and BlockNumber associated type (#804)

* remove unneeded Config bounds and BlockNumber associated type

* clippy and fmt
This commit is contained in:
James Wilson
2023-01-27 14:01:47 +00:00
committed by GitHub
parent 171bd62bb2
commit ce0a82e322
27 changed files with 72 additions and 112 deletions
@@ -106,8 +106,7 @@ fn check_documentation() {
for raw in raw_docs.iter() {
assert!(
runtime_docs.contains(raw),
"Documentation not present in runtime API: {}",
raw
"Documentation not present in runtime API: {raw}"
);
}
}
@@ -194,8 +194,7 @@ async fn tx_instantiate_with_code() {
assert!(
result.is_ok(),
"Error calling instantiate_with_code and receiving CodeStored and Instantiated Events: {:?}",
result
"Error calling instantiate_with_code and receiving CodeStored and Instantiated Events: {result:?}"
);
}
@@ -208,8 +207,7 @@ async fn tx_instantiate() {
assert!(
instantiated.is_ok(),
"Error instantiating contract: {:?}",
instantiated
"Error instantiating contract: {instantiated:?}"
);
}
@@ -244,9 +242,9 @@ async fn tx_call() {
.iter()
.map(|key| hex::encode(&key.0))
.collect::<Vec<_>>();
println!("keys post: {:?}", keys);
println!("keys post: {keys:?}");
let executed = cxt.call(contract, vec![]).await;
assert!(executed.is_ok(), "Error calling contract: {:?}", executed);
assert!(executed.is_ok(), "Error calling contract: {executed:?}");
}
@@ -27,7 +27,7 @@ use subxt::error::{
/// Helper function to generate a crypto pair from seed
fn get_from_seed(seed: &str) -> sr25519::Pair {
sr25519::Pair::from_string(&format!("//{}", seed), None)
sr25519::Pair::from_string(&format!("//{seed}"), None)
.expect("static values are valid; qed")
}
@@ -103,7 +103,7 @@ impl TestNodeProcessBuilder {
.arg("--ws-port=0");
if let Some(authority) = self.authority {
let authority = format!("{:?}", authority);
let authority = format!("{authority:?}");
let arg = format!("--{}", authority.as_str().to_lowercase());
cmd.arg(arg);
}
@@ -119,14 +119,14 @@ impl TestNodeProcessBuilder {
// Wait for RPC port to be logged (it's logged to stderr):
let stderr = proc.stderr.take().unwrap();
let ws_port = find_substrate_port_from_output(stderr);
let ws_url = format!("ws://127.0.0.1:{}", ws_port);
let ws_url = format!("ws://127.0.0.1:{ws_port}");
// Connect to the node with a subxt client:
let client = OnlineClient::from_url(ws_url.clone()).await;
match client {
Ok(client) => Ok(TestNodeProcess { proc, client }),
Err(err) => {
let err = format!("Failed to connect to node rpc at {}: {}", ws_url, err);
let err = format!("Failed to connect to node rpc at {ws_url}: {err}");
tracing::error!("{}", err);
proc.kill().map_err(|e| {
format!("Error killing substrate process '{}': {}", proc.id(), e)
+5 -5
View File
@@ -33,7 +33,7 @@ async fn run() {
let cmd = Command::new(&substrate_bin)
.arg("--dev")
.arg("--tmp")
.arg(format!("--ws-port={}", port))
.arg(format!("--ws-port={port}"))
.spawn();
let mut cmd = match cmd {
Ok(cmd) => KillOnDrop(cmd),
@@ -42,7 +42,7 @@ async fn run() {
See https://github.com/paritytech/subxt/tree/master#integration-testing")
}
Err(e) => {
panic!("Cannot spawn substrate command '{}': {}", substrate_bin, e)
panic!("Cannot spawn substrate command '{substrate_bin}': {e}")
}
};
@@ -53,13 +53,13 @@ async fn run() {
loop {
if retries >= MAX_RETRIES {
panic!("Cannot connect to substrate node after {} retries", retries);
panic!("Cannot connect to substrate node after {retries} retries");
}
// It might take a while for substrate node that spin up the RPC server.
// Thus, the connection might get rejected a few times.
use client::ClientT;
let res = match client::build(&format!("ws://localhost:{}", port)).await {
let res = match client::build(&format!("ws://localhost:{port}")).await {
Ok(c) => c.request("state_getMetadata", client::rpc_params![]).await,
Err(e) => Err(e),
};
@@ -114,7 +114,7 @@ async fn run() {
substrate_path.to_string_lossy()
);
// Re-build if we point to a different substrate binary:
println!("cargo:rerun-if-env-changed={}", SUBSTRATE_BIN_ENV_VAR);
println!("cargo:rerun-if-env-changed={SUBSTRATE_BIN_ENV_VAR}");
// Re-build if this file changes:
println!("cargo:rerun-if-changed=build.rs");
}