clippy cleanup #2

- remove needless return
- remove needless format!
- remove a few more needless clone()
- from_str_radix(_, 10) -> .parse()
- remove needless reference
- remove needless `mut`

Also manually replaced a match statement with map_err() because after
clippy was done with it, there was almost nothing left in the match
expression.
This commit is contained in:
Eric Seppanen
2021-04-16 16:55:04 -07:00
parent 69b786040e
commit 1f3f4cfaf5
20 changed files with 101 additions and 110 deletions

View File

@@ -11,7 +11,6 @@ use std::{collections::BTreeMap, path::PathBuf};
use anyhow::{Context, Result};
use lazy_static::lazy_static;
use regex::Regex;
use tar;
use postgres::{Client, NoTls};
@@ -290,7 +289,7 @@ impl PostgresNode {
// slot or something proper, to prevent the compute node
// from removing WAL that hasn't been streamed to the safekeepr or
// page server yet. But this will do for now.
self.append_conf("postgresql.conf", &format!("wal_keep_size='10TB'\n"));
self.append_conf("postgresql.conf", "wal_keep_size='10TB'\n");
// Connect it to the page server.

View File

@@ -108,7 +108,7 @@ pub fn init() -> Result<()> {
// ok, we are good to go
let mut conf = LocalEnv {
repo_path: repo_path.clone(),
repo_path,
pg_distrib_dir,
zenith_distrib_dir,
systemid: 0,
@@ -254,7 +254,7 @@ pub fn test_env(testname: &str) -> LocalEnv {
systemid: 0,
};
init_repo(&mut local_env).expect("could not initialize zenith repository");
return local_env;
local_env
}
// Find the directory where the binaries were put (i.e. target/debug/)
@@ -266,7 +266,7 @@ pub fn cargo_bin_dir() -> PathBuf {
pathbuf.pop();
}
return pathbuf;
pathbuf
}
#[derive(Debug, Clone, Copy)]
@@ -358,7 +358,7 @@ pub fn find_end_of_wal(local_env: &LocalEnv, timeline: ZTimelineId) -> Result<u6
let (lsn, _tli) = xlog_utils::find_end_of_wal(&waldir, 16 * 1024 * 1024, true);
return Ok(lsn);
Ok(lsn)
}
// Find the latest snapshot for a timeline

View File

@@ -56,7 +56,7 @@ impl TestStorageControlPlane {
wal_acceptors: Vec::new(),
pageserver: pserver,
test_done: AtomicBool::new(false),
repopath: repopath,
repopath,
}
}
@@ -73,7 +73,7 @@ impl TestStorageControlPlane {
wal_acceptors: Vec::new(),
pageserver: pserver,
test_done: AtomicBool::new(false),
repopath: repopath,
repopath,
}
}
@@ -89,7 +89,7 @@ impl TestStorageControlPlane {
listen_address: None,
}),
test_done: AtomicBool::new(false),
repopath: repopath,
repopath,
};
cplane.pageserver.start().unwrap();
@@ -233,7 +233,7 @@ impl PageServerNode {
if !status.success() {
anyhow::bail!("Failed to stop pageserver with pid {}", pid);
} else {
return Ok(());
Ok(())
}
}