Skip to content

Commit 72aa10e

Browse files
committed
rustfmt updates.
1 parent 0c67f43 commit 72aa10e

File tree

4 files changed

+26
-49
lines changed

4 files changed

+26
-49
lines changed

rustfmt.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
struct_lit_width = 24
2+
fn_single_line = true
3+
format_strings = false

src/error.rs

+5-15
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,23 @@ pub enum DashError {
2323
}
2424

2525
impl From<hyper::error::Error> for DashError {
26-
fn from(e: hyper::error::Error) -> Self {
27-
DashError::Hyper(e)
28-
}
26+
fn from(e: hyper::error::Error) -> Self { DashError::Hyper(e) }
2927
}
3028

3129
impl From<io::Error> for DashError {
32-
fn from(e: io::Error) -> Self {
33-
DashError::Io(e)
34-
}
30+
fn from(e: io::Error) -> Self { DashError::Io(e) }
3531
}
3632

3733
impl From<serde_json::error::Error> for DashError {
38-
fn from(e: serde_json::error::Error) -> Self {
39-
DashError::Serde(e)
40-
}
34+
fn from(e: serde_json::error::Error) -> Self { DashError::Serde(e) }
4135
}
4236

4337
impl From<r2d2::GetTimeout> for DashError {
44-
fn from(e: r2d2::GetTimeout) -> Self {
45-
DashError::R2d2Timeout(e)
46-
}
38+
fn from(e: r2d2::GetTimeout) -> Self { DashError::R2d2Timeout(e) }
4739
}
4840

4941
impl From<diesel::result::Error> for DashError {
50-
fn from(e: diesel::result::Error) -> Self {
51-
DashError::DieselError(e)
52-
}
42+
fn from(e: diesel::result::Error) -> Self { DashError::DieselError(e) }
5343
}
5444

5545
impl From<DashError> for iron::IronError {

src/releases.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,8 @@ fn get_release_for_date(d: NaiveDate) -> DashResult<Release> {
3434

3535
let response = try!(CLIENT.get(&url).send());
3636
match response.status {
37-
StatusCode::Ok => {
38-
Ok(Release {
39-
date: d,
40-
released: true,
41-
})
42-
}
43-
_ => {
44-
Ok(Release {
45-
date: d,
46-
released: false,
47-
})
48-
}
37+
StatusCode::Ok => Ok(Release { date: d, released: true }),
38+
_ => Ok(Release { date: d, released: false }),
4939
}
5040
}
5141

src/reports/mod.rs

+16-22
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use domain::releases::Release;
1414
use error::DashResult;
1515

1616
pub mod nag;
17-
mod teams;
1817

1918
pub type EpochTimestamp = i64;
2019

@@ -229,32 +228,27 @@ pub fn open_prs_avg_days_old() -> DashResult<f64> {
229228
let conn = try!(DB_POOL.get());
230229
Ok(try!(pullrequest.select(sql::<Double>("AVG(EXTRACT(EPOCH FROM (now() - created_at))) / \
231230
(60 * 60 * 24)"))
232-
.filter(closed_at.is_null())
233-
.first(&*conn)))
231+
.filter(closed_at.is_null())
232+
.first(&*conn)))
234233
}
235234

236235
pub fn bors_retries_last_week() -> DashResult<Vec<BorsRetry>> {
237236
let conn = try!(DB_POOL.get());
238237

239238
// waiting on associations to get this into proper typed queries
240239

241-
Ok(try!(select(sql::<(VarChar, Integer, Integer, VarChar, Bool)>("i.repository, i.number, \
242-
ic.id, i.title, \
243-
pr.merged_at IS NOT NULL
244-
\
245-
FROM issuecomment ic, \
246-
issue i, pullrequest pr \
247-
WHERE ic.body LIKE \
248-
'%@bors%retry%' AND i.id \
249-
= ic.fk_issue AND \
250-
i.is_pull_request AND \
251-
ic.created_at > NOW() - \
252-
'7 days'::interval AND \
253-
pr.repository = \
254-
i.repository AND \
255-
pr.number = i.number \
256-
ORDER BY ic.created_at \
257-
DESC"))
240+
Ok(try!(select(
241+
sql::<(VarChar, Integer, Integer, VarChar, Bool)>(
242+
"i.repository, i.number, ic.id, i.title, pr.merged_at IS NOT NULL \
243+
FROM issuecomment ic, issue i, pullrequest pr \
244+
WHERE \
245+
ic.body LIKE '%@bors%retry%' AND \
246+
i.id = ic.fk_issue AND \
247+
i.is_pull_request AND \
248+
ic.created_at > NOW() - '7 days'::interval AND \
249+
pr.repository = i.repository AND \
250+
pr.number = i.number \
251+
ORDER BY ic.created_at DESC"))
258252
.load(&*conn)))
259253
}
260254

@@ -333,8 +327,8 @@ pub fn open_issues_avg_days_old() -> DashResult<f64> {
333327
let conn = try!(DB_POOL.get());
334328
Ok(try!(issue.select(sql::<Double>("AVG(EXTRACT(EPOCH FROM (now() - created_at))) / \
335329
(60 * 60 * 24)"))
336-
.filter(closed_at.is_null())
337-
.first(&*conn)))
330+
.filter(closed_at.is_null())
331+
.first(&*conn)))
338332
}
339333

340334
pub fn open_issues_with_label(label: &str) -> DashResult<i64> {

0 commit comments

Comments
 (0)