Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] clippy warnings #187

Merged
merged 1 commit into from
Jun 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/src/commands/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Manifest, u32, petgraph::Directed> = Graph::new();
Expand Down Expand Up @@ -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())
Expand Down
6 changes: 3 additions & 3 deletions app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 2 additions & 8 deletions lib/src/actions/file/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion lib/src/actions/package/providers/aptitude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/actions/package/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/atoms/file/decrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/src/atoms/git/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};

Expand All @@ -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()
};

Expand Down
6 changes: 2 additions & 4 deletions lib/src/contexts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ pub fn to_rhai(context: &Contexts) -> rhai::Scope {
};

scope.push_constant(m.clone(), dynamic);

()
});

scope
Expand Down Expand Up @@ -135,7 +133,7 @@ mod test {

let config = Config {
manifest_paths: vec![],
variables: variables,
variables,
};

let contexts = build_contexts(&config);
Expand Down Expand Up @@ -163,7 +161,7 @@ mod test {

let config = Config {
manifest_paths: vec![],
variables: variables,
variables,
};

std::env::set_var("ASCENDED_NAME", "Morgan Le Fay");
Expand Down
4 changes: 2 additions & 2 deletions lib/src/manifests/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn load(manifest_path: PathBuf, contexts: &Contexts) -> HashMap<String, Mani
let mut tera = Tera::default();
register_functions(&mut tera);

let yaml = match tera.render_str(template, &to_tera(&contexts)) {
let yaml = match tera.render_str(template, &to_tera(contexts)) {
Ok(template) => template,
Err(err) => {
match err.source() {
Expand Down Expand Up @@ -105,5 +105,5 @@ pub fn load(manifest_path: PathBuf, contexts: &Contexts) -> HashMap<String, Mani
span.exit();
});

return manifests;
manifests
}