Skip to content

Commit b132485

Browse files
committed
cargo fmt
1 parent fda7cb9 commit b132485

File tree

5 files changed

+163
-29
lines changed

5 files changed

+163
-29
lines changed

src/rustup-cli/common.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ pub fn update_all_channels(cfg: &Cfg, do_self_update: bool, force_update: bool)
224224
}
225225

226226
pub fn self_update<F>(before_restart: F) -> Result<()>
227-
where F: FnOnce() -> Result<()>
227+
where
228+
F: FnOnce() -> Result<()>,
228229
{
229230
let setup_path = self_update::prepare_update()?;
230231

src/rustup-cli/rustup_mode.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,11 +620,7 @@ fn update(cfg: &Cfg, m: &ArgMatches) -> Result<()> {
620620
common::self_update(|| Ok(()))?;
621621
}
622622
} else {
623-
common::update_all_channels(
624-
cfg,
625-
self_update,
626-
m.is_present("force"),
627-
)?;
623+
common::update_all_channels(cfg, self_update, m.is_present("force"))?;
628624
}
629625

630626
Ok(())

tests/cli-rustup.rs

Lines changed: 138 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,13 @@ fn rustup_xz() {
260260
set_current_dist_date(config, "2015-01-01");
261261
expect_stderr_ok(
262262
config,
263-
&["rustup", "--verbose", "update", "nightly", "--no-self-update"],
263+
&[
264+
"rustup",
265+
"--verbose",
266+
"update",
267+
"nightly",
268+
"--no-self-update",
269+
],
264270
for_host!(r"dist/2015-01-01/rust-std-nightly-{0}.tar.xz"),
265271
);
266272
});
@@ -904,7 +910,10 @@ fn set_default_host_invalid_triple() {
904910
fn update_doesnt_update_non_tracking_channels() {
905911
setup(&|config| {
906912
expect_ok(config, &["rustup", "default", "nightly"]);
907-
expect_ok(config, &["rustup", "update", "nightly-2015-01-01", "--no-self-update"]);
913+
expect_ok(
914+
config,
915+
&["rustup", "update", "nightly-2015-01-01", "--no-self-update"],
916+
);
908917
let mut cmd = clitools::cmd(config, "rustup", &["update"]);
909918
clitools::env(config, &mut cmd);
910919
let out = cmd.output().unwrap();
@@ -918,7 +927,16 @@ fn update_doesnt_update_non_tracking_channels() {
918927
#[test]
919928
fn toolchain_install_is_like_update() {
920929
setup(&|config| {
921-
expect_ok(config, &["rustup", "toolchain", "install", "nightly", "--no-self-update"]);
930+
expect_ok(
931+
config,
932+
&[
933+
"rustup",
934+
"toolchain",
935+
"install",
936+
"nightly",
937+
"--no-self-update",
938+
],
939+
);
922940
expect_stdout_ok(
923941
config,
924942
&["rustup", "run", "nightly", "rustc", "--version"],
@@ -941,7 +959,16 @@ fn toolchain_install_is_like_update_except_that_bare_install_is_an_error() {
941959
#[test]
942960
fn toolchain_update_is_like_update() {
943961
setup(&|config| {
944-
expect_ok(config, &["rustup", "toolchain", "update", "nightly", "--no-self-update"]);
962+
expect_ok(
963+
config,
964+
&[
965+
"rustup",
966+
"toolchain",
967+
"update",
968+
"nightly",
969+
"--no-self-update",
970+
],
971+
);
945972
expect_stdout_ok(
946973
config,
947974
&["rustup", "run", "nightly", "rustc", "--version"],
@@ -978,7 +1005,16 @@ fn toolchain_update_is_like_update_except_that_bare_install_is_an_error() {
9781005
fn proxy_toolchain_shorthand() {
9791006
setup(&|config| {
9801007
expect_ok(config, &["rustup", "default", "stable"]);
981-
expect_ok(config, &["rustup", "toolchain", "update", "nightly", "--no-self-update"]);
1008+
expect_ok(
1009+
config,
1010+
&[
1011+
"rustup",
1012+
"toolchain",
1013+
"update",
1014+
"nightly",
1015+
"--no-self-update",
1016+
],
1017+
);
9821018
expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2");
9831019
expect_stdout_ok(config, &["rustc", "+stable", "--version"], "hash-s-2");
9841020
expect_stdout_ok(config, &["rustc", "+nightly", "--version"], "hash-n-2");
@@ -1237,7 +1273,16 @@ fn multirust_upgrade_works_with_proxy() {
12371273
fn file_override() {
12381274
setup(&|config| {
12391275
expect_ok(config, &["rustup", "default", "stable"]);
1240-
expect_ok(config, &["rustup", "toolchain", "install", "nightly", "--no-self-update"]);
1276+
expect_ok(
1277+
config,
1278+
&[
1279+
"rustup",
1280+
"toolchain",
1281+
"install",
1282+
"nightly",
1283+
"--no-self-update",
1284+
],
1285+
);
12411286

12421287
expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2");
12431288

@@ -1253,7 +1298,16 @@ fn file_override() {
12531298
fn file_override_subdir() {
12541299
setup(&|config| {
12551300
expect_ok(config, &["rustup", "default", "stable"]);
1256-
expect_ok(config, &["rustup", "toolchain", "install", "nightly", "--no-self-update"]);
1301+
expect_ok(
1302+
config,
1303+
&[
1304+
"rustup",
1305+
"toolchain",
1306+
"install",
1307+
"nightly",
1308+
"--no-self-update",
1309+
],
1310+
);
12571311

12581312
expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2");
12591313

@@ -1275,7 +1329,13 @@ fn file_override_with_archive() {
12751329
expect_ok(config, &["rustup", "default", "stable"]);
12761330
expect_ok(
12771331
config,
1278-
&["rustup", "toolchain", "install", "nightly-2015-01-01", "--no-self-update"],
1332+
&[
1333+
"rustup",
1334+
"toolchain",
1335+
"install",
1336+
"nightly-2015-01-01",
1337+
"--no-self-update",
1338+
],
12791339
);
12801340

12811341
expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2");
@@ -1292,8 +1352,20 @@ fn file_override_with_archive() {
12921352
fn directory_override_beats_file_override() {
12931353
setup(&|config| {
12941354
expect_ok(config, &["rustup", "default", "stable"]);
1295-
expect_ok(config, &["rustup", "toolchain", "install", "beta", "--no-self-update"]);
1296-
expect_ok(config, &["rustup", "toolchain", "install", "nightly", "--no-self-update"]);
1355+
expect_ok(
1356+
config,
1357+
&["rustup", "toolchain", "install", "beta", "--no-self-update"],
1358+
);
1359+
expect_ok(
1360+
config,
1361+
&[
1362+
"rustup",
1363+
"toolchain",
1364+
"install",
1365+
"nightly",
1366+
"--no-self-update",
1367+
],
1368+
);
12971369

12981370
expect_ok(config, &["rustup", "override", "set", "beta"]);
12991371
expect_stdout_ok(config, &["rustc", "--version"], "hash-b-2");
@@ -1310,8 +1382,20 @@ fn directory_override_beats_file_override() {
13101382
fn close_file_override_beats_far_directory_override() {
13111383
setup(&|config| {
13121384
expect_ok(config, &["rustup", "default", "stable"]);
1313-
expect_ok(config, &["rustup", "toolchain", "install", "beta", "--no-self-update"]);
1314-
expect_ok(config, &["rustup", "toolchain", "install", "nightly", "--no-self-update"]);
1385+
expect_ok(
1386+
config,
1387+
&["rustup", "toolchain", "install", "beta", "--no-self-update"],
1388+
);
1389+
expect_ok(
1390+
config,
1391+
&[
1392+
"rustup",
1393+
"toolchain",
1394+
"install",
1395+
"nightly",
1396+
"--no-self-update",
1397+
],
1398+
);
13151399

13161400
expect_ok(config, &["rustup", "override", "set", "beta"]);
13171401
expect_stdout_ok(config, &["rustc", "--version"], "hash-b-2");
@@ -1334,7 +1418,10 @@ fn close_file_override_beats_far_directory_override() {
13341418
fn directory_override_doesnt_need_to_exist_unless_it_is_selected() {
13351419
setup(&|config| {
13361420
expect_ok(config, &["rustup", "default", "stable"]);
1337-
expect_ok(config, &["rustup", "toolchain", "install", "beta", "--no-self-update"]);
1421+
expect_ok(
1422+
config,
1423+
&["rustup", "toolchain", "install", "beta", "--no-self-update"],
1424+
);
13381425
// not installing nightly
13391426

13401427
expect_ok(config, &["rustup", "override", "set", "beta"]);
@@ -1352,8 +1439,20 @@ fn directory_override_doesnt_need_to_exist_unless_it_is_selected() {
13521439
fn env_override_beats_file_override() {
13531440
setup(&|config| {
13541441
expect_ok(config, &["rustup", "default", "stable"]);
1355-
expect_ok(config, &["rustup", "toolchain", "install", "beta", "--no-self-update"]);
1356-
expect_ok(config, &["rustup", "toolchain", "install", "nightly", "--no-self-update"]);
1442+
expect_ok(
1443+
config,
1444+
&["rustup", "toolchain", "install", "beta", "--no-self-update"],
1445+
);
1446+
expect_ok(
1447+
config,
1448+
&[
1449+
"rustup",
1450+
"toolchain",
1451+
"install",
1452+
"nightly",
1453+
"--no-self-update",
1454+
],
1455+
);
13571456

13581457
let cwd = config.current_dir();
13591458
let toolchain_file = cwd.join("rust-toolchain");
@@ -1372,8 +1471,20 @@ fn env_override_beats_file_override() {
13721471
fn plus_override_beats_file_override() {
13731472
setup(&|config| {
13741473
expect_ok(config, &["rustup", "default", "stable"]);
1375-
expect_ok(config, &["rustup", "toolchain", "install", "beta", "--no-self-update"]);
1376-
expect_ok(config, &["rustup", "toolchain", "install", "nightly", "--no-self-update"]);
1474+
expect_ok(
1475+
config,
1476+
&["rustup", "toolchain", "install", "beta", "--no-self-update"],
1477+
);
1478+
expect_ok(
1479+
config,
1480+
&[
1481+
"rustup",
1482+
"toolchain",
1483+
"install",
1484+
"nightly",
1485+
"--no-self-update",
1486+
],
1487+
);
13771488

13781489
let cwd = config.current_dir();
13791490
let toolchain_file = cwd.join("rust-toolchain");
@@ -1417,7 +1528,16 @@ fn file_override_with_target_info() {
14171528
fn docs_with_path() {
14181529
setup(&|config| {
14191530
expect_ok(config, &["rustup", "default", "stable"]);
1420-
expect_ok(config, &["rustup", "toolchain", "install", "nightly", "--no-self-update"]);
1531+
expect_ok(
1532+
config,
1533+
&[
1534+
"rustup",
1535+
"toolchain",
1536+
"install",
1537+
"nightly",
1538+
"--no-self-update",
1539+
],
1540+
);
14211541

14221542
let mut cmd = clitools::cmd(config, "rustup", &["doc", "--path"]);
14231543
clitools::env(config, &mut cmd);

tests/cli-v1.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ fn update_channel() {
9898
fn list_toolchains() {
9999
clitools::setup(Scenario::ArchivesV1, &|config| {
100100
expect_ok(config, &["rustup", "update", "nightly", "--no-self-update"]);
101-
expect_ok(config, &["rustup", "update", "beta-2015-01-01", "--no-self-update"]);
101+
expect_ok(
102+
config,
103+
&["rustup", "update", "beta-2015-01-01", "--no-self-update"],
104+
);
102105
expect_stdout_ok(config, &["rustup", "toolchain", "list"], "nightly");
103106
expect_stdout_ok(config, &["rustup", "toolchain", "list"], "beta-2015-01-01");
104107
});
@@ -321,7 +324,11 @@ fn remove_override_with_multiple_overrides() {
321324
fn no_update_on_channel_when_date_has_not_changed() {
322325
setup(&|config| {
323326
expect_ok(config, &["rustup", "update", "nightly", "--no-self-update"]);
324-
expect_stdout_ok(config, &["rustup", "update", "nightly", "--no-self-update"], "unchanged");
327+
expect_stdout_ok(
328+
config,
329+
&["rustup", "update", "nightly", "--no-self-update"],
330+
"unchanged",
331+
);
325332
});
326333
}
327334

tests/cli-v2.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ fn update_channel() {
100100
fn list_toolchains() {
101101
clitools::setup(Scenario::ArchivesV2, &|config| {
102102
expect_ok(config, &["rustup", "update", "nightly", "--no-self-update"]);
103-
expect_ok(config, &["rustup", "update", "beta-2015-01-01", "--no-self-update"]);
103+
expect_ok(
104+
config,
105+
&["rustup", "update", "beta-2015-01-01", "--no-self-update"],
106+
);
104107
expect_stdout_ok(config, &["rustup", "toolchain", "list"], "nightly");
105108
expect_stdout_ok(config, &["rustup", "toolchain", "list"], "beta-2015-01-01");
106109
});
@@ -152,7 +155,10 @@ fn add_remove_multiple_toolchains() {
152155
let tch1 = "beta";
153156
let tch2 = "nightly";
154157

155-
expect_ok(config, &["rustup", "toolchain", add, tch1, tch2, "--no-self-update"]);
158+
expect_ok(
159+
config,
160+
&["rustup", "toolchain", add, tch1, tch2, "--no-self-update"],
161+
);
156162
expect_ok(config, &["rustup", "toolchain", "list"]);
157163
expect_stdout_ok(config, &["rustup", "toolchain", "list"], tch1);
158164
expect_stdout_ok(config, &["rustup", "toolchain", "list"], tch2);
@@ -418,7 +424,11 @@ fn remove_override_with_multiple_overrides() {
418424
fn no_update_on_channel_when_date_has_not_changed() {
419425
setup(&|config| {
420426
expect_ok(config, &["rustup", "update", "nightly", "--no-self-update"]);
421-
expect_stdout_ok(config, &["rustup", "update", "nightly", "--no-self-update"], "unchanged");
427+
expect_stdout_ok(
428+
config,
429+
&["rustup", "update", "nightly", "--no-self-update"],
430+
"unchanged",
431+
);
422432
});
423433
}
424434

0 commit comments

Comments
 (0)