Skip to content

Commit

Permalink
chore: fix clippy (#864)
Browse files Browse the repository at this point in the history
* clippy fix

* fix more clippy

* cargo fmt
  • Loading branch information
niklasad1 authored Jul 2, 2024
1 parent 444bb16 commit 6957154
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/commands/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ where
let _lock = submit_lock.lock().await;

let (solution, score) = match epm::fetch_snapshot_and_mine_solution::<T>(
&client.chain_api(),
client.chain_api(),
Some(block_hash),
config.solver,
round,
Expand Down
2 changes: 1 addition & 1 deletion src/epm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ where
targets.remove(&rm);
}

return Err(Error::Feasibility("Failed to pre-trim weight < T::MaxLength".to_string()));
Err(Error::Feasibility("Failed to pre-trim weight < T::MaxLength".to_string()))
}

/// Clone the state and trim it, so it get can be reverted.
Expand Down
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub enum Error {
#[error("I/O error: `{0}`")]
Io(#[from] std::io::Error),
#[error("RPC error: `{0}`")]
RpcError(#[from] jsonrpsee::core::ClientError),
Rpc(#[from] jsonrpsee::core::ClientError),
#[error("subxt error: `{0}`")]
Subxt(#[from] subxt::Error),
#[error("Crypto error: `{0:?}`")]
Expand Down Expand Up @@ -51,7 +51,7 @@ pub enum Error {
#[error("Feasibility error: {0}")]
Feasibility(String),
#[error("{0}")]
JoinError(#[from] tokio::task::JoinError),
Join(#[from] tokio::task::JoinError),
#[error("Empty snapshot")]
EmptySnapshot,
}
2 changes: 1 addition & 1 deletion src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub fn kill_main_task_if_critical_err(tx: &tokio::sync::mpsc::UnboundedSender<Er
Error::BetterScoreExist |
Error::IncorrectPhase |
Error::TransactionRejected(_) |
Error::JoinError(_) |
Error::Join(_) |
Error::Feasibility(_) |
Error::EmptySnapshot => {},
Error::Subxt(SubxtError::Rpc(rpc_err)) => {
Expand Down
8 changes: 5 additions & 3 deletions tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub fn run_polkadot_node(chain: Chain) -> (KillChildOnDrop, String) {
.stderr(process::Stdio::piped())
.args([
"--chain",
&chain_str,
chain_str,
"--tmp",
"--alice",
"--unsafe-force-node-key-generation",
Expand Down Expand Up @@ -141,14 +141,16 @@ pub fn spawn_cli_output_threads(
) {
let tx2 = tx.clone();
std::thread::spawn(move || {
for line in BufReader::new(stdout).lines().flatten() {
for line in BufReader::new(stdout).lines() {
let line = line.expect("Failed to read line from stdout");
println!("OK: {}", line);
let _ = tx2.send(line);
}
});

std::thread::spawn(move || {
for line in BufReader::new(stderr).lines().flatten() {
for line in BufReader::new(stderr).lines() {
let line = line.expect("Failed to read line from stdout");
println!("ERR: {}", line);
let _ = tx.send(line);
}
Expand Down

0 comments on commit 6957154

Please sign in to comment.