Skip to content

Commit 51ca8d8

Browse files
committed
fix formatting
1 parent 90604f9 commit 51ca8d8

File tree

7 files changed

+31
-20
lines changed

7 files changed

+31
-20
lines changed

src/bin/rla-server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct Cli {
6868
repo: String,
6969
#[structopt(
7070
long = "secondary-repo",
71-
help="Secondary repositories to listen for builds.",
71+
help = "Secondary repositories to listen for builds.",
7272
required = false,
7373
multiple = true
7474
)]

src/bin/server/worker.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ impl Worker {
9595
fn process(&mut self, item: QueueItem) -> rla::Result<()> {
9696
let (repo, build_id, outcome) = match &item {
9797
QueueItem::GitHubStatus(ev) => match self.ci.build_id_from_github_status(&ev) {
98-
Some(id) if self.is_repo_valid(&ev.repository.full_name) => (&ev.repository.full_name, id, None),
98+
Some(id) if self.is_repo_valid(&ev.repository.full_name) => {
99+
(&ev.repository.full_name, id, None)
100+
}
99101
_ => {
100102
info!(
101103
"Ignoring invalid event (ctx: {:?}, url: {:?}).",
@@ -105,7 +107,9 @@ impl Worker {
105107
}
106108
},
107109
QueueItem::GitHubCheckRun(ev) => match self.ci.build_id_from_github_check(&ev) {
108-
Some(id) if self.is_repo_valid(&ev.repository.full_name) => (&ev.repository.full_name, id, Some(&ev.check_run.outcome)),
110+
Some(id) if self.is_repo_valid(&ev.repository.full_name) => {
111+
(&ev.repository.full_name, id, Some(&ev.check_run.outcome))
112+
}
109113
_ => {
110114
info!(
111115
"Ignoring invalid event (app id: {:?}, url: {:?}).",
@@ -295,8 +299,10 @@ impl Worker {
295299
match ci::download_log(self.ci.as_ref(), *job, self.github.internal()) {
296300
Some(Ok(log)) => {
297301
for line in rla::sanitize::split_lines(&log) {
298-
self.index
299-
.learn(&rla::index::Sanitized(rla::sanitize::clean(self.ci.as_ref(), line)), 1);
302+
self.index.learn(
303+
&rla::index::Sanitized(rla::sanitize::clean(self.ci.as_ref(), line)),
304+
1,
305+
);
300306
}
301307
}
302308
None => {

src/ci/actions.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use crate::ci::{Build, BuildCommit, CiPlatform, Job, Outcome};
2-
use crate::github::{CheckRun, BuildOutcome};
2+
use crate::github::{BuildOutcome, CheckRun};
33
use crate::Result;
44
use regex::Regex;
55
use reqwest::{Client as ReqwestClient, Method, RequestBuilder, Response};
6-
use std::collections::HashMap;
76
use std::borrow::Cow;
7+
use std::collections::HashMap;
88

99
#[derive(Deserialize)]
1010
struct ActionsRun {
@@ -241,10 +241,7 @@ impl CiPlatform for Client {
241241

242242
fn query_build(&self, repo: &str, id: u64) -> Result<Box<dyn Build>> {
243243
let run: ActionsRun = self
244-
.req(
245-
Method::GET,
246-
&format!("repos/{}/actions/runs/{}", repo, id),
247-
)?
244+
.req(Method::GET, &format!("repos/{}/actions/runs/{}", repo, id))?
248245
.error_for_status()?
249246
.json()?;
250247
Ok(GHABuild::new(self, repo, run)?)
@@ -267,7 +264,11 @@ impl CiPlatform for Client {
267264
}
268265
}
269266

270-
fn fetch_workflow_run_id_from_check_run(client: &Client, repo: &str, run: &CheckRun) -> Result<u64> {
267+
fn fetch_workflow_run_id_from_check_run(
268+
client: &Client,
269+
repo: &str,
270+
run: &CheckRun,
271+
) -> Result<u64> {
271272
#[derive(Deserialize)]
272273
struct ResponseRuns {
273274
total_count: usize,

src/ci/azure.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use crate::ci::{Build, BuildCommit, CiPlatform, Job, Outcome};
33
use crate::Result;
44
use failure::ResultExt;
55
use reqwest::{Client as ReqwestClient, Method, Response, StatusCode};
6+
use std::borrow::Cow;
67
use std::fmt;
78
use std::io::Read;
8-
use std::borrow::Cow;
99

1010
#[derive(Debug, Eq, PartialEq, Deserialize)]
1111
#[serde(rename_all = "camelCase")]
@@ -99,7 +99,9 @@ impl Job for AzureJob {
9999
fn html_url(&self) -> String {
100100
format!(
101101
"https://dev.azure.com/{repo}/_build/results?buildId={build}&view=logs&jobId={job}",
102-
repo = self.repo, build = self.build, job = self.record.id
102+
repo = self.repo,
103+
build = self.build,
104+
job = self.record.id
103105
)
104106
}
105107

@@ -340,7 +342,11 @@ impl CiPlatform for Client {
340342
}
341343

342344
fn query_build(&self, repo: &str, id: u64) -> Result<Box<dyn Build>> {
343-
let resp = self.req(Method::GET, repo, &format!("build/builds/{}?api-version=5.0", id))?;
345+
let resp = self.req(
346+
Method::GET,
347+
repo,
348+
&format!("build/builds/{}?api-version=5.0", id),
349+
)?;
344350
let mut resp = resp.error_for_status()?;
345351
let data: AzureBuildData = resp.json()?;
346352
if let Some(build) = AzureBuild::new(&self, repo, data)? {

src/ci/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use reqwest::RequestBuilder;
2-
use std::io::Read;
32
use std::borrow::Cow;
3+
use std::io::Read;
44

55
mod actions;
66
mod azure;

src/github.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ impl Client {
150150
.timeout(Some(Duration::from_secs(TIMEOUT_SECS)))
151151
.build()?;
152152

153-
Ok(Client {
154-
internal: client,
155-
})
153+
Ok(Client { internal: client })
156154
}
157155

158156
pub fn query_pr(&self, repo: &str, pr_id: u32) -> Result<Pr> {

src/sanitize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use regex::bytes::Regex;
21
use crate::ci::CiPlatform;
2+
use regex::bytes::Regex;
33

44
pub fn split_lines(data: &[u8]) -> Vec<&[u8]> {
55
lazy_static! {

0 commit comments

Comments
 (0)