summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-08-06 09:41:02 +0300
committerLars Wirzenius <liw@liw.fi>2021-08-06 09:41:02 +0300
commit6fc3ad8a6758bb6c764ba208d814c1ab82d764ac (patch)
treec7871da86dbb89792af674aeb336a830fe3d7005 /src
parente403fab2890cf33fc70bc9becf5e7fd6523008e5 (diff)
downloadvmadm-6fc3ad8a6758bb6c764ba208d814c1ab82d764ac.tar.gz
chore: fix small problems found by clippy
Sponsored-by: author
Diffstat (limited to 'src')
-rw-r--r--src/bin/vmadm.rs4
-rw-r--r--src/cloudinit.rs4
-rw-r--r--src/cmd/cloud_init.rs2
-rw-r--r--src/spec.rs6
-rw-r--r--src/util.rs2
5 files changed, 9 insertions, 9 deletions
diff --git a/src/bin/vmadm.rs b/src/bin/vmadm.rs
index 7a4493e..a288036 100644
--- a/src/bin/vmadm.rs
+++ b/src/bin/vmadm.rs
@@ -141,8 +141,8 @@ fn main() -> anyhow::Result<()> {
}
fn get_specs(common: &CommonOptions, spec: &Path) -> anyhow::Result<Vec<Specification>> {
- let config = config(&common)?;
- let specs = Specification::from_file(&config, &spec)?;
+ let config = config(common)?;
+ let specs = Specification::from_file(&config, spec)?;
Ok(specs)
}
diff --git a/src/cloudinit.rs b/src/cloudinit.rs
index 88d1dcf..4fdf9d1 100644
--- a/src/cloudinit.rs
+++ b/src/cloudinit.rs
@@ -161,7 +161,7 @@ impl Metadata {
fn cleanup_document(doc: &str) -> String {
let doc = doc.strip_prefix("---\n").or(Some(doc)).unwrap();
- let doc = doc.strip_suffix("\n").or(Some(doc)).unwrap();
+ let doc = doc.strip_suffix('\n').or(Some(doc)).unwrap();
doc.to_string()
}
@@ -256,7 +256,7 @@ impl Hostkeys {
}
if let Some(filename) = &spec.ca_key {
debug!("Generating host key and certificate");
- let ca = CaKey::from_file(&filename)?;
+ let ca = CaKey::from_file(filename)?;
let pair = KeyPair::generate(KeyKind::Ed25519)?;
let cert = ca.certify_host(&pair, &spec.name)?;
debug!("generated Ed25519 host certificate {:?}", cert);
diff --git a/src/cmd/cloud_init.rs b/src/cmd/cloud_init.rs
index b266eb4..dc9af66 100644
--- a/src/cmd/cloud_init.rs
+++ b/src/cmd/cloud_init.rs
@@ -31,7 +31,7 @@ pub fn cloud_init(specs: &[Specification], dirname: &Path) -> Result<(), CloudIn
dirname.display()
);
- let init = CloudInitConfig::from(&spec)?;
+ let init = CloudInitConfig::from(spec)?;
debug!("creating directory {}", dirname.display());
std::fs::create_dir_all(&dirname)?;
diff --git a/src/spec.rs b/src/spec.rs
index c3c6b59..9f8d3e8 100644
--- a/src/spec.rs
+++ b/src/spec.rs
@@ -68,7 +68,7 @@ impl OneVmInputSpecification {
get(
&self.image,
- &default_image,
+ default_image,
SpecificationError::NoImage(name.to_string()),
)
}
@@ -268,7 +268,7 @@ impl Specification {
let mut machines = vec![];
for (name, machine) in input.iter() {
- let spec = Specification::one_machine(config, &name, &machine)?;
+ let spec = Specification::one_machine(config, name, machine)?;
debug!("machine with defaults applied: {:#?}", spec);
machines.push(spec);
}
@@ -330,7 +330,7 @@ fn ssh_keys(filenames: &[PathBuf]) -> Result<Vec<String>, SpecificationError> {
let key =
std::fs::read(&filename).map_err(|e| SpecificationError::SshKeyRead(filename, e))?;
let key = String::from_utf8(key)?;
- let key = key.strip_suffix("\n").or(Some(&key)).unwrap();
+ let key = key.strip_suffix('\n').or(Some(&key)).unwrap();
keys.push(key.to_string());
}
Ok(keys)
diff --git a/src/util.rs b/src/util.rs
index c641ea6..9a86ea0 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -44,7 +44,7 @@ pub fn expand_optional_pathbufs(maybe_paths: &mut Option<Vec<PathBuf>>) {
if let Some(paths) = maybe_paths {
let mut expanded = vec![];
for path in paths {
- expanded.push(expand_tilde(&path));
+ expanded.push(expand_tilde(path));
}
*maybe_paths = Some(expanded);
}