Skip to content

Commit 63ce705

Browse files
committed
run rustfmt and clippy after stable update
1 parent dcc7699 commit 63ce705

File tree

36 files changed

+210
-183
lines changed

36 files changed

+210
-183
lines changed

src/actions/experiments/create.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ mod tests {
112112
html_url: html_url.to_string(),
113113
number: 10,
114114
}),
115-
}.apply(&db, &config)
115+
}
116+
.apply(&db, &config)
116117
.unwrap();
117118

118119
let ex = Experiment::get(&db, "foo").unwrap().unwrap();
@@ -154,7 +155,8 @@ mod tests {
154155
cap_lints: CapLints::Forbid,
155156
priority: 0,
156157
github_issue: None,
157-
}.apply(&db, &config)
158+
}
159+
.apply(&db, &config)
158160
.unwrap_err();
159161

160162
assert_eq!(
@@ -179,7 +181,8 @@ mod tests {
179181
cap_lints: CapLints::Forbid,
180182
priority: 0,
181183
github_issue: None,
182-
}.apply(&db, &config)
184+
}
185+
.apply(&db, &config)
183186
.unwrap();
184187

185188
// While the second one fails
@@ -191,7 +194,8 @@ mod tests {
191194
cap_lints: CapLints::Forbid,
192195
priority: 0,
193196
github_issue: None,
194-
}.apply(&db, &config)
197+
}
198+
.apply(&db, &config)
195199
.unwrap_err();
196200

197201
assert_eq!(

src/actions/experiments/delete.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ mod tests {
3737

3838
let err = DeleteExperiment {
3939
name: "dummy".to_string(),
40-
}.apply(&db, &config)
40+
}
41+
.apply(&db, &config)
4142
.unwrap_err();
4243

4344
assert_eq!(
@@ -62,7 +63,8 @@ mod tests {
6263
// Delete it and make sure it doesn't exist anymore
6364
DeleteExperiment {
6465
name: "dummy".to_string(),
65-
}.apply(&db, &config)
66+
}
67+
.apply(&db, &config)
6668
.unwrap();
6769
assert!(!Experiment::exists(&db, "dummy").unwrap());
6870
}

src/actions/experiments/edit.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ mod tests {
168168
cap_lints: CapLints::Forbid,
169169
priority: 0,
170170
github_issue: None,
171-
}.apply(&db, &config)
171+
}
172+
.apply(&db, &config)
172173
.unwrap();
173174

174175
// Change everything!
@@ -182,7 +183,8 @@ mod tests {
182183
crates: Some(CrateSelect::Local),
183184
cap_lints: Some(CapLints::Warn),
184185
priority: Some(10),
185-
}.apply(&db, &config)
186+
}
187+
.apply(&db, &config)
186188
.unwrap();
187189

188190
// And get the experiment to make sure data is changed

src/agent/api.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ impl AgentApi {
7979
AUTHORIZATION,
8080
(CraterToken {
8181
token: self.token.clone(),
82-
}).to_string(),
82+
})
83+
.to_string(),
8384
)
8485
}
8586

@@ -162,7 +163,8 @@ impl AgentApi {
162163
},
163164
],
164165
"shas": shas,
165-
})).send()?
166+
}))
167+
.send()?
166168
.to_api_response()?;
167169
Ok(())
168170
})

src/cli.rs

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,11 @@ pub enum Crater {
7676
about = "acquire toolchains, build containers, build crate lists"
7777
)]
7878
PrepareLocal {
79-
#[structopt(
80-
name = "docker env",
81-
long = "docker-env",
82-
default_value = "full"
83-
)]
79+
#[structopt(name = "docker env", long = "docker-env", default_value = "full")]
8480
env: DockerEnv,
8581
},
8682

87-
#[structopt(
88-
name = "create-lists",
89-
about = "create all the lists of crates"
90-
)]
83+
#[structopt(name = "create-lists", about = "create all the lists of crates")]
9184
CreateLists {
9285
#[structopt(name = "lists")]
9386
lists: Vec<String>,
@@ -128,12 +121,7 @@ pub enum Crater {
128121
)
129122
)]
130123
cap_lints: CapLints,
131-
#[structopt(
132-
name = "priority",
133-
long = "priority",
134-
short = "p",
135-
default_value = "0"
136-
)]
124+
#[structopt(name = "priority", long = "priority", short = "p", default_value = "0")]
137125
priority: i32,
138126
},
139127

@@ -163,14 +151,11 @@ pub enum Crater {
163151
raw(possible_values = "CapLints::possible_values()")
164152
)]
165153
cap_lints: Option<CapLints>,
166-
#[structopt(name = "priority", long = "priority", short = "p",)]
154+
#[structopt(name = "priority", long = "priority", short = "p")]
167155
priority: Option<i32>,
168156
},
169157

170-
#[structopt(
171-
name = "delete-ex",
172-
about = "delete shared data for experiment"
173-
)]
158+
#[structopt(name = "delete-ex", about = "delete shared data for experiment")]
174159
DeleteEx {
175160
#[structopt(long = "ex", default_value = "default")]
176161
ex: Ex,
@@ -202,19 +187,11 @@ pub enum Crater {
202187
RunGraph {
203188
#[structopt(name = "experiment", long = "ex", default_value = "default")]
204189
ex: Ex,
205-
#[structopt(
206-
name = "threads",
207-
short = "t",
208-
long = "threads",
209-
default_value = "1"
210-
)]
190+
#[structopt(name = "threads", short = "t", long = "threads", default_value = "1")]
211191
threads: usize,
212192
},
213193

214-
#[structopt(
215-
name = "gen-report",
216-
about = "generate the experiment report"
217-
)]
194+
#[structopt(name = "gen-report", about = "generate the experiment report")]
218195
GenReport {
219196
#[structopt(name = "experiment", long = "ex", default_value = "default")]
220197
ex: Ex,
@@ -224,10 +201,7 @@ pub enum Crater {
224201
force: bool,
225202
},
226203

227-
#[structopt(
228-
name = "publish-report",
229-
about = "publish the experiment report to S3"
230-
)]
204+
#[structopt(name = "publish-report", about = "publish the experiment report to S3")]
231205
PublishReport {
232206
#[structopt(
233207
name = "experiment",
@@ -251,12 +225,7 @@ pub enum Crater {
251225
url: String,
252226
#[structopt(name = "token")]
253227
token: String,
254-
#[structopt(
255-
name = "threads",
256-
short = "t",
257-
long = "threads",
258-
default_value = "1"
259-
)]
228+
#[structopt(name = "threads", short = "t", long = "threads", default_value = "1")]
260229
threads: usize,
261230
},
262231

@@ -334,7 +303,8 @@ impl Crater {
334303
cap_lints: *cap_lints,
335304
priority: *priority,
336305
github_issue: None,
337-
}.apply(&db, &config)?;
306+
}
307+
.apply(&db, &config)?;
338308
}
339309
Crater::Edit {
340310
ref name,
@@ -355,7 +325,8 @@ impl Crater {
355325
crates: *crates,
356326
cap_lints: *cap_lints,
357327
priority: *priority,
358-
}.apply(&db, &config)?;
328+
}
329+
.apply(&db, &config)?;
359330
}
360331
Crater::DeleteEx { ref ex } => {
361332
let config = Config::load()?;

src/crates/lists.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ pub(crate) trait List {
2727
t.execute(
2828
"INSERT INTO crates (crate, list, loaded_at) VALUES (?1, ?2, ?3);",
2929
&[&::serde_json::to_string(krate)?, &Self::NAME, &now],
30-
).with_context(|_| {
30+
)
31+
.with_context(|_| {
3132
format!(
3233
"failed to insert crate {} into the {} list",
3334
krate,
@@ -138,5 +139,6 @@ pub(crate) fn setup_test_lists(db: &Database, config: &Config) -> Fallible<()> {
138139
github: false,
139140
registry: false,
140141
local: true,
141-
}.apply(db, config)
142+
}
143+
.apply(db, config)
142144
}

src/crates/sources/local.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ impl List for LocalList {
3636
"invalid UTF-8 in local crate name: {}",
3737
entry.file_name().to_string_lossy()
3838
))
39-
})?.to_string();
39+
})?
40+
.to_string();
4041

4142
list.push(Crate::Local(name));
4243
}

src/db/migrations.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ pub fn execute(db: &mut Connection) -> Fallible<()> {
274274
match migration {
275275
MigrationKind::SQL(sql) => t.execute_batch(sql),
276276
MigrationKind::Code(code) => code(&t),
277-
}.with_context(|_| format!("error running migration: {}", name))?;
277+
}
278+
.with_context(|_| format!("error running migration: {}", name))?;
278279

279280
t.execute("INSERT INTO migrations (name) VALUES (?1)", &[&name])?;
280281
t.commit()?;

src/docker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl ContainerBuilder {
109109

110110
for &(ref var, ref value) in &self.env {
111111
args.push("-e".into());
112-
args.push(format!{"{}={}", var, value})
112+
args.push(format! {"{}={}", var, value})
113113
}
114114

115115
if let Some(limit) = self.memory_limit {

src/experiments.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,17 @@ impl Experiment {
265265
"SELECT COUNT(*) AS count FROM results WHERE experiment = ?1;",
266266
&[&self.name.as_str()],
267267
|r| r.get("count"),
268-
)?.unwrap();
268+
)?
269+
.unwrap();
269270

270271
let crates_len: u32 = db
271272
.get_row(
272273
"SELECT COUNT(*) AS count FROM experiment_crates \
273274
WHERE experiment = ?1 AND skipped = 0;",
274275
&[&self.name.as_str()],
275276
|r| r.get("count"),
276-
)?.unwrap();
277+
)?
278+
.unwrap();
277279

278280
Ok((results_len, crates_len * 2))
279281
}
@@ -298,7 +300,8 @@ impl Experiment {
298300
WHERE experiment = ?1 AND crate = ?2;",
299301
&[&self.name.as_str(), &serde_json::to_string(&krate)?],
300302
|r| r.get("count"),
301-
)?.unwrap();
303+
)?
304+
.unwrap();
302305

303306
if results_len < 2 {
304307
new_crates.push(krate);
@@ -358,7 +361,8 @@ impl ExperimentDBRecord {
358361
let value: String = r.get("crate");
359362
Ok(serde_json::from_str(&value)?)
360363
},
361-
)?.into_iter()
364+
)?
365+
.into_iter()
362366
.collect::<Fallible<Vec<Crate>>>()?;
363367

364368
Ok(Experiment {

0 commit comments

Comments
 (0)