diff --git a/ofborg/src/asynccmd.rs b/ofborg/src/asynccmd.rs index 8fc670e..a3b5d3e 100644 --- a/ofborg/src/asynccmd.rs +++ b/ofborg/src/asynccmd.rs @@ -166,7 +166,7 @@ impl AsyncCmd { } } - if waiters.len() == 0 { + if waiters.is_empty() { debug!("Closing up the waiter receiver thread, no more waiters."); break; } diff --git a/ofborg/src/commentparser.rs b/ofborg/src/commentparser.rs index b8d552e..e37296f 100644 --- a/ofborg/src/commentparser.rs +++ b/ofborg/src/commentparser.rs @@ -8,7 +8,7 @@ pub fn parse(text: &str) -> Option> { }) .collect(); - if instructions.len() == 0 { + if instructions.is_empty() { None } else { Some(instructions) diff --git a/ofborg/src/tagger.rs b/ofborg/src/tagger.rs index e7289fa..249c497 100644 --- a/ofborg/src/tagger.rs +++ b/ofborg/src/tagger.rs @@ -78,11 +78,11 @@ impl PkgsAddedRemovedTagger { } pub fn changed(&mut self, removed: &[PackageArch], added: &[PackageArch]) { - if removed.len() > 0 { + if !removed.is_empty() { self.selected.push(String::from("8.has: clean-up")); } - if added.len() > 0 { + if !added.is_empty() { self.selected.push(String::from("8.has: package (new)")); } } diff --git a/ofborg/src/tasks/build.rs b/ofborg/src/tasks/build.rs index 4d39d93..a18f7e1 100644 --- a/ofborg/src/tasks/build.rs +++ b/ofborg/src/tasks/build.rs @@ -295,7 +295,7 @@ impl notifyworker::SimpleNotifyWorker for BuildWorker { ) { let mut actions = self.actions(&job, notifier); - if job.attrs.len() == 0 { + if job.attrs.is_empty() { actions.nothing_to_do(); return; } @@ -360,7 +360,7 @@ impl notifyworker::SimpleNotifyWorker for BuildWorker { actions.log_started(can_build.clone(), cannot_build_attrs.clone()); actions.log_instantiation_errors(cannot_build); - if can_build.len() == 0 { + if can_build.is_empty() { actions.build_not_attempted(cannot_build_attrs); return; } diff --git a/ofborg/src/tasks/eval/stdenvs.rs b/ofborg/src/tasks/eval/stdenvs.rs index 9769c31..0726848 100644 --- a/ofborg/src/tasks/eval/stdenvs.rs +++ b/ofborg/src/tasks/eval/stdenvs.rs @@ -51,7 +51,7 @@ impl Stdenvs { } pub fn are_same(&self) -> bool { - self.changed().len() == 0 + self.changed().is_empty() } pub fn changed(&self) -> Vec { diff --git a/ofborg/src/tasks/githubcommentfilter.rs b/ofborg/src/tasks/githubcommentfilter.rs index d72411c..7561ec4 100644 --- a/ofborg/src/tasks/githubcommentfilter.rs +++ b/ofborg/src/tasks/githubcommentfilter.rs @@ -64,7 +64,7 @@ impl worker::SimpleWorker for GitHubCommentWorker { &job.repository.full_name, ); - if build_destinations.len() == 0 { + if build_destinations.is_empty() { println!("No build destinations for: {:?}", job); // Don't process comments if they can't build anything return vec![worker::Action::Ack]; diff --git a/ofborg/src/tasks/githubcommentposter.rs b/ofborg/src/tasks/githubcommentposter.rs index 8b16bb0..c13b9d4 100644 --- a/ofborg/src/tasks/githubcommentposter.rs +++ b/ofborg/src/tasks/githubcommentposter.rs @@ -85,7 +85,7 @@ fn result_to_check(result: &LegacyBuildResult, timestamp: DateTime) -> Chec .collect(); all_attrs.sort(); - if all_attrs.len() == 0{ + if all_attrs.is_empty() { all_attrs = vec![String::from("(unknown attributes)")]; } @@ -117,7 +117,7 @@ fn result_to_check(result: &LegacyBuildResult, timestamp: DateTime) -> Chec let text: String; - if result.output.len() > 0 { + if !result.output.is_empty() { let mut reply: Vec = vec![]; reply.push("## Partial log".to_owned()); @@ -166,7 +166,7 @@ fn result_to_check(result: &LegacyBuildResult, timestamp: DateTime) -> Chec fn result_to_comment(result: &LegacyBuildResult) -> String { let mut reply: Vec = vec![]; - let log_link = if result.output.len() > 0 { + let log_link = if !result.output.is_empty() { format!( " [(full log)](https://logs.nix.ci/?key={}/{}.{}&attempt_id={})", &result.repo.owner.to_lowercase(), @@ -205,7 +205,7 @@ fn result_to_comment(result: &LegacyBuildResult) -> String { &skipped)); } - if result.output.len() > 0 { + if !result.output.is_empty() { reply.extend(partial_log_segment(result.output.clone())); reply.push("".to_owned()); reply.push("".to_owned()); @@ -220,7 +220,7 @@ fn result_to_comment(result: &LegacyBuildResult) -> String { fn list_segment(name: &str, things: &[String]) -> Vec { let mut reply: Vec = vec![]; - if things.len() > 0 { + if !things.is_empty() { reply.push(format!("{}: {}", name, things.join(", "))); reply.push("".to_owned()); } diff --git a/ofborg/src/tasks/massrebuilder.rs b/ofborg/src/tasks/massrebuilder.rs index 343bcc2..f99090b 100644 --- a/ofborg/src/tasks/massrebuilder.rs +++ b/ofborg/src/tasks/massrebuilder.rs @@ -487,7 +487,7 @@ impl worker::SimpleWorker for MassRebuildWorker 0 && try_build.len() <= 10 { + if !try_build.is_empty() && try_build.len() <= 10 { // In the case of trying to merge master in to // a stable branch, we don't want to do this. // Therefore, only schedule builds if there @@ -550,7 +550,7 @@ impl worker::SimpleWorker for MassRebuildWorker 0 { + if !attrs.is_empty() { let gist_url = make_gist( &gists, "Changed Paths",