Fix Clippy (#2522)

* Import Clippy config from Polkadot

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Auto clippy fix

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* No tabs in comments

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Prefer matches

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Dont drop references

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Trivial

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Refactor

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add clippy to ci

* Clippy reborrow

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update client/pov-recovery/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/pov-recovery/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Partially revert 'Prefer matches'

Using matches! instead of match does give less compiler
checks as per review from @chevdor.

Partially reverts 8c0609677f3ea040f77fffd5be6facf7c3fec95c

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update .cargo/config.toml

Co-authored-by: Chevdor <chevdor@users.noreply.github.com>

* Revert revert 💩

Should be fine to use matches! macro since it is an explicit whitelist,
not wildcard matching.

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: alvicsam <alvicsam@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Chevdor <chevdor@users.noreply.github.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
Oliver Tale-Yazdi
2023-05-06 08:01:03 +02:00
committed by GitHub
parent b72ae577a0
commit 299d25ba4b
92 changed files with 910 additions and 967 deletions
@@ -8,7 +8,7 @@ use std::{
use tempfile::tempdir;
/// The runtimes that this command supports.
static RUNTIMES: [&'static str; 3] = ["westmint", "statemine", "statemint"];
static RUNTIMES: [&str; 3] = ["westmint", "statemine", "statemint"];
/// The `benchmark storage` command works for the dev runtimes.
#[test]
@@ -31,7 +31,7 @@ fn benchmark_storage_works() {
/// Invoke the `benchmark storage` sub-command for the given database and runtime.
fn benchmark_storage(db: &str, runtime: &str, base_path: &Path) -> ExitStatus {
Command::new(cargo_bin("polkadot-parachain"))
.args(&["benchmark", "storage", "--chain", runtime])
.args(["benchmark", "storage", "--chain", runtime])
.arg("--db")
.arg(db)
.arg("--weight-path")
+2 -2
View File
@@ -117,12 +117,12 @@ pub fn find_ws_url_from_output(read: impl Read + Send) -> (String, String) {
line.expect("failed to obtain next line from stdout for WS address discovery");
data.push_str(&line);
data.push_str("\n");
data.push('\n');
// does the line contain our port (we expect this specific output from substrate).
let sock_addr = match line.split_once("Running JSON-RPC server: addr=") {
None => return None,
Some((_, after)) => after.split_once(",").unwrap().0,
Some((_, after)) => after.split_once(',').unwrap().0,
};
Some(format!("ws://{}", sock_addr))
@@ -38,7 +38,7 @@ async fn purge_chain_works() {
assert!(base_dir.path().join("polkadot/chains/dev/db/full").exists());
let status = Command::new(cargo_bin("polkadot-parachain"))
.args(&["purge-chain", "-d"])
.args(["purge-chain", "-d"])
.arg(base_dir.path())
.arg("-y")
.status()