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:
James Wilson
2021-11-19 10:36:38 +00:00
committed by GitHub
parent dcb78a2784
commit 97f4112e92
16 changed files with 190 additions and 79 deletions
+8 -11
View File
@@ -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 {