diff --git a/app/src/commands/apply.rs b/app/src/commands/apply.rs index 50b2cbf1..89c9fb57 100644 --- a/app/src/commands/apply.rs +++ b/app/src/commands/apply.rs @@ -33,7 +33,7 @@ pub(crate) fn execute(args: &Apply, runtime: &Runtime) -> anyhow::Result<()> { let contexts = &runtime.contexts; - let manifests = load(manifest_path, &contexts); + let manifests = load(manifest_path, contexts); // Build DAG let mut dag: Graph = Graph::new(); @@ -128,7 +128,7 @@ pub(crate) fn execute(args: &Apply, runtime: &Runtime) -> anyhow::Result<()> { let action = action.inner_ref(); let mut steps = action - .plan(m1, &contexts) + .plan(m1, contexts) .into_iter() .filter(|step| step.do_initializers_allow_us_to_run()) .filter(|step| step.atom.plan()) diff --git a/app/src/main.rs b/app/src/main.rs index 28fdb284..7791ea79 100644 --- a/app/src/main.rs +++ b/app/src/main.rs @@ -84,9 +84,9 @@ fn main(args: GlobalArgs) -> anyhow::Result<()> { let contexts = build_contexts(&config); let runtime = Runtime { - args: args, - config: config, - contexts: contexts, + args, + config, + contexts, }; execute(runtime) diff --git a/lib/src/actions/file/link.rs b/lib/src/actions/file/link.rs index 8efa46c0..d971dd8e 100644 --- a/lib/src/actions/file/link.rs +++ b/lib/src/actions/file/link.rs @@ -257,16 +257,10 @@ mod tests { let contexts = build_contexts(&config); - let target: String = source_dir - .clone() - .parent() - .unwrap() - .to_str() - .unwrap() - .to_string(); + let target: String = source_dir.parent().unwrap().to_str().unwrap().to_string(); let file_link_action: FileLink = FileLink { - source: Some(source_dir.clone().to_str().unwrap().to_string()), + source: Some(source_dir.to_str().unwrap().to_string()), target: Some(target), walk_dir: true, ..Default::default() diff --git a/lib/src/actions/package/providers/aptitude.rs b/lib/src/actions/package/providers/aptitude.rs index 9c70b99a..4062bfdb 100644 --- a/lib/src/actions/package/providers/aptitude.rs +++ b/lib/src/actions/package/providers/aptitude.rs @@ -66,7 +66,7 @@ impl PackageProvider for Aptitude { if repository.key.is_some() { let key = repository.clone().key.unwrap(); - let key_name = key.name.unwrap_or(digest(&key.url)); + let key_name = key.name.unwrap_or_else(|| digest(&key.url)); let key_path = format!("/usr/sharekeyrings/{}.asc", key_name); signed_by = format!("signed-by={}", key_path); diff --git a/lib/src/actions/package/repository.rs b/lib/src/actions/package/repository.rs index 78716c4e..924cedf0 100644 --- a/lib/src/actions/package/repository.rs +++ b/lib/src/actions/package/repository.rs @@ -54,8 +54,8 @@ impl Action for PackageRepository { atoms.append(&mut provider.bootstrap()); } - if !provider.has_repository(&self) { - atoms.append(&mut provider.add_repository(&self)); + if !provider.has_repository(self) { + atoms.append(&mut provider.add_repository(self)); } span.exit(); diff --git a/lib/src/atoms/file/decrypt.rs b/lib/src/atoms/file/decrypt.rs index 616f41e1..d2bab7b0 100644 --- a/lib/src/atoms/file/decrypt.rs +++ b/lib/src/atoms/file/decrypt.rs @@ -96,7 +96,7 @@ mod tests { let decrypt = Decrypt { encrypted_content: encrypted_content.to_owned(), path: file.path().to_path_buf(), - passphrase: passphrase.to_owned(), + passphrase: passphrase, }; // plan @@ -130,7 +130,7 @@ mod tests { let mut decrypt = Decrypt { encrypted_content: encrypted_content.to_owned(), path: file.path().to_path_buf(), - passphrase: passphrase.to_owned(), + passphrase: passphrase, }; // plan, execute diff --git a/lib/src/atoms/git/clone.rs b/lib/src/atoms/git/clone.rs index 1ea2bfe0..536853e6 100644 --- a/lib/src/atoms/git/clone.rs +++ b/lib/src/atoms/git/clone.rs @@ -71,7 +71,7 @@ mod tests { let git_clone = Clone { repository: String::from("https://github.com/comtrya/comtrya"), - directory: temp_dir.path().join("nonexistent").to_path_buf(), + directory: temp_dir.path().join("nonexistent"), ..Default::default() }; @@ -90,7 +90,7 @@ mod tests { let mut git_clone = Clone { repository: String::from("https://github.com/comtrya/comtrya"), - directory: temp_dir.path().join("clone").to_path_buf(), + directory: temp_dir.path().join("clone"), ..Default::default() }; diff --git a/lib/src/contexts/mod.rs b/lib/src/contexts/mod.rs index 2291c846..53abd11e 100644 --- a/lib/src/contexts/mod.rs +++ b/lib/src/contexts/mod.rs @@ -95,8 +95,6 @@ pub fn to_rhai(context: &Contexts) -> rhai::Scope { }; scope.push_constant(m.clone(), dynamic); - - () }); scope @@ -135,7 +133,7 @@ mod test { let config = Config { manifest_paths: vec![], - variables: variables, + variables, }; let contexts = build_contexts(&config); @@ -163,7 +161,7 @@ mod test { let config = Config { manifest_paths: vec![], - variables: variables, + variables, }; std::env::set_var("ASCENDED_NAME", "Morgan Le Fay"); diff --git a/lib/src/manifests/load.rs b/lib/src/manifests/load.rs index 031fc64f..dab84e58 100644 --- a/lib/src/manifests/load.rs +++ b/lib/src/manifests/load.rs @@ -70,7 +70,7 @@ pub fn load(manifest_path: PathBuf, contexts: &Contexts) -> HashMap template, Err(err) => { match err.source() { @@ -105,5 +105,5 @@ pub fn load(manifest_path: PathBuf, contexts: &Contexts) -> HashMap