clippy: if _ then _ ... is an expression

This commit is contained in:
Graham Christensen 2019-01-02 19:09:37 -05:00
parent 8fe689989a
commit 2b338c3549
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
4 changed files with 18 additions and 27 deletions

View file

@ -51,9 +51,8 @@ fn main() {
})
.unwrap();
let queue_name: String;
if cfg.runner.build_all_jobs != Some(true) {
queue_name = channel
let queue_name: String = if cfg.runner.build_all_jobs != Some(true) {
channel
.declare_queue(easyamqp::QueueConfig {
queue: format!("build-inputs-{}", cfg.nix.system.clone()),
passive: false,
@ -63,11 +62,11 @@ fn main() {
no_wait: false,
arguments: None,
})
.unwrap().queue;
.unwrap().queue
} else {
warn!("Building all jobs, please don't use this unless you're");
warn!("developing and have Graham's permission!");
queue_name = channel
channel
.declare_queue(easyamqp::QueueConfig {
queue: "".to_owned(),
passive: false,
@ -77,8 +76,8 @@ fn main() {
no_wait: false,
arguments: None,
})
.unwrap().queue;
}
.unwrap().queue
};
channel
.bind_queue(easyamqp::BindQueueConfig {

View file

@ -204,14 +204,11 @@ impl Nix {
let stderr = tempfile().expect("Fetching a stderr tempfile");
let mut reader = stderr.try_clone().expect("Cloning stderr to the reader");
let stdout: Stdio;
if keep_stdout {
let stdout_fd = stderr.try_clone().expect("Cloning stderr for stdout");
stdout = Stdio::from(stdout_fd);
let stdout: Stdio = if keep_stdout {
Stdio::from(stderr.try_clone().expect("Cloning stderr for stdout"))
} else {
stdout = Stdio::null();
}
Stdio::null()
};
let status = cmd.stdout(Stdio::from(stdout))
.stderr(Stdio::from(stderr))

View file

@ -161,13 +161,11 @@ impl OutPaths {
}
fn execute(&self) -> Result<File, File> {
let check_meta: String;
if self.check_meta {
check_meta = String::from("true");
let check_meta: String = if self.check_meta {
String::from("true")
} else {
check_meta = String::from("false");
}
String::from("false")
};
self.nix.safely(
nix::Operation::QueryPackagesOutputs,

View file

@ -115,9 +115,7 @@ fn result_to_check(result: &LegacyBuildResult, timestamp: DateTime<Utc>) -> Chec
&skipped));
}
let text: String;
if !result.output.is_empty() {
let text: String = if !result.output.is_empty() {
let mut reply: Vec<String> = vec![];
reply.push("## Partial log".to_owned());
@ -126,11 +124,10 @@ fn result_to_check(result: &LegacyBuildResult, timestamp: DateTime<Utc>) -> Chec
reply.extend(result.output.clone());
reply.push("```".to_owned());
text = reply.join("\n");
reply.join("\n")
} else {
text = String::from("No partial log is available.");
}
String::from("No partial log is available.")
};
CheckRunOptions{
name: format!(