Skip to content

Commit 2cd36b4

Browse files
committed
Auto merge of #5791 - dwijnand:oneline-files, r=alexcrichton
Declare one-line files on one line, in test projects Builds on #5787 Fixes #5745 unless @alexcrichton feels more can be done there.
2 parents cb9c0b0 + 6ca32be commit 2cd36b4

40 files changed

+400
-2524
lines changed

tests/testsuite/bad_config.rs

+8-48
Original file line numberDiff line numberDiff line change
@@ -599,19 +599,9 @@ Caused by:
599599
fn duplicate_deps() {
600600
let p = project()
601601
.file("shim-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
602-
.file(
603-
"shim-bar/src/lib.rs",
604-
r#"
605-
pub fn a() {}
606-
"#,
607-
)
602+
.file("shim-bar/src/lib.rs", "pub fn a() {}")
608603
.file("linux-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
609-
.file(
610-
"linux-bar/src/lib.rs",
611-
r#"
612-
pub fn a() {}
613-
"#,
614-
)
604+
.file("linux-bar/src/lib.rs", "pub fn a() {}")
615605
.file(
616606
"Cargo.toml",
617607
r#"
@@ -648,19 +638,9 @@ have a single canonical source path irrespective of build target.
648638
fn duplicate_deps_diff_sources() {
649639
let p = project()
650640
.file("shim-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
651-
.file(
652-
"shim-bar/src/lib.rs",
653-
r#"
654-
pub fn a() {}
655-
"#,
656-
)
641+
.file("shim-bar/src/lib.rs", "pub fn a() {}")
657642
.file("linux-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
658-
.file(
659-
"linux-bar/src/lib.rs",
660-
r#"
661-
pub fn a() {}
662-
"#,
663-
)
643+
.file("linux-bar/src/lib.rs", "pub fn a() {}")
664644
.file(
665645
"Cargo.toml",
666646
r#"
@@ -734,12 +714,7 @@ warning: unused manifest key: target.foo.bar
734714
bulid = "foo"
735715
"#,
736716
)
737-
.file(
738-
"src/lib.rs",
739-
r#"
740-
pub fn foo() {}
741-
"#,
742-
)
717+
.file("src/lib.rs", "pub fn foo() {}")
743718
.build();
744719
assert_that(
745720
p.cargo("build"),
@@ -766,12 +741,7 @@ warning: unused manifest key: project.bulid
766741
build = "foo"
767742
"#,
768743
)
769-
.file(
770-
"src/lib.rs",
771-
r#"
772-
pub fn foo() {}
773-
"#,
774-
)
744+
.file("src/lib.rs", "pub fn foo() {}")
775745
.build();
776746
assert_that(
777747
p.cargo("build"),
@@ -845,12 +815,7 @@ to use. This will be considered an error in future versions
845815
#[test]
846816
fn invalid_toml_historically_allowed_is_warned() {
847817
let p = project()
848-
.file(
849-
".cargo/config",
850-
r#"
851-
[bar] baz = 2
852-
"#,
853-
)
818+
.file(".cargo/config", "[bar] baz = 2")
854819
.file("src/main.rs", "fn main() {}")
855820
.build();
856821

@@ -908,12 +873,7 @@ This will be considered an error in future versions
908873
fn bad_source_config1() {
909874
let p = project()
910875
.file("src/lib.rs", "")
911-
.file(
912-
".cargo/config",
913-
r#"
914-
[source.foo]
915-
"#,
916-
)
876+
.file(".cargo/config", "[source.foo]")
917877
.build();
918878

919879
assert_that(

tests/testsuite/bench.rs

+13-79
Original file line numberDiff line numberDiff line change
@@ -724,9 +724,7 @@ fn dont_run_examples() {
724724
.file("src/lib.rs", r"")
725725
.file(
726726
"examples/dont-run-me-i-will-fail.rs",
727-
r#"
728-
fn main() { panic!("Examples should not be run by 'cargo test'"); }
729-
"#,
727+
r#"fn main() { panic!("Examples should not be run by 'cargo test'"); }"#,
730728
)
731729
.build();
732730
assert_that(p.cargo("bench"), execs().with_status(0));
@@ -944,12 +942,7 @@ fn lib_with_standard_name2() {
944942
doctest = false
945943
"#,
946944
)
947-
.file(
948-
"src/lib.rs",
949-
"
950-
pub fn foo() {}
951-
",
952-
)
945+
.file("src/lib.rs", "pub fn foo() {}")
953946
.file(
954947
"src/main.rs",
955948
"
@@ -1043,12 +1036,7 @@ fn bench_dylib() {
10431036
crate_type = ["dylib"]
10441037
"#,
10451038
)
1046-
.file(
1047-
"bar/src/lib.rs",
1048-
"
1049-
pub fn baz() {}
1050-
",
1051-
)
1039+
.file("bar/src/lib.rs", "pub fn baz() {}")
10521040
.build();
10531041

10541042
assert_that(
@@ -1263,13 +1251,7 @@ fn test_a_bench() {
12631251
"#,
12641252
)
12651253
.file("src/lib.rs", "")
1266-
.file(
1267-
"benches/b.rs",
1268-
r#"
1269-
#[test]
1270-
fn foo() {}
1271-
"#,
1272-
)
1254+
.file("benches/b.rs", "#[test] fn foo() {}")
12731255
.build();
12741256

12751257
assert_that(
@@ -1483,12 +1465,7 @@ fn bench_all_workspace() {
14831465
[workspace]
14841466
"#,
14851467
)
1486-
.file(
1487-
"src/main.rs",
1488-
r#"
1489-
fn main() {}
1490-
"#,
1491-
)
1468+
.file("src/main.rs", "fn main() {}")
14921469
.file(
14931470
"benches/foo.rs",
14941471
r#"
@@ -1502,12 +1479,7 @@ fn bench_all_workspace() {
15021479
"#,
15031480
)
15041481
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
1505-
.file(
1506-
"bar/src/lib.rs",
1507-
r#"
1508-
pub fn bar() {}
1509-
"#,
1510-
)
1482+
.file("bar/src/lib.rs", "pub fn bar() {}")
15111483
.file(
15121484
"bar/benches/bar.rs",
15131485
r#"
@@ -1551,12 +1523,7 @@ fn bench_all_exclude() {
15511523
members = ["bar", "baz"]
15521524
"#,
15531525
)
1554-
.file(
1555-
"src/main.rs",
1556-
r#"
1557-
fn main() {}
1558-
"#,
1559-
)
1526+
.file("src/main.rs", "fn main() {}")
15601527
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
15611528
.file(
15621529
"bar/src/lib.rs",
@@ -1572,15 +1539,7 @@ fn bench_all_exclude() {
15721539
"#,
15731540
)
15741541
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
1575-
.file(
1576-
"baz/src/lib.rs",
1577-
r#"
1578-
#[test]
1579-
pub fn baz() {
1580-
break_the_build();
1581-
}
1582-
"#,
1583-
)
1542+
.file("baz/src/lib.rs", "#[test] pub fn baz() { break_the_build(); }")
15841543
.build();
15851544

15861545
assert_that(
@@ -1608,12 +1567,7 @@ fn bench_all_virtual_manifest() {
16081567
"#,
16091568
)
16101569
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
1611-
.file(
1612-
"bar/src/lib.rs",
1613-
r#"
1614-
pub fn bar() {}
1615-
"#,
1616-
)
1570+
.file("bar/src/lib.rs", "pub fn bar() {}")
16171571
.file(
16181572
"bar/benches/bar.rs",
16191573
r#"
@@ -1627,12 +1581,7 @@ fn bench_all_virtual_manifest() {
16271581
"#,
16281582
)
16291583
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
1630-
.file(
1631-
"baz/src/lib.rs",
1632-
r#"
1633-
pub fn baz() {}
1634-
"#,
1635-
)
1584+
.file("baz/src/lib.rs", "pub fn baz() {}")
16361585
.file(
16371586
"baz/benches/baz.rs",
16381587
r#"
@@ -1678,12 +1627,7 @@ fn legacy_bench_name() {
16781627
name = "bench"
16791628
"#,
16801629
)
1681-
.file(
1682-
"src/lib.rs",
1683-
r#"
1684-
pub fn foo() {}
1685-
"#,
1686-
)
1630+
.file("src/lib.rs", "pub fn foo() {}")
16871631
.file(
16881632
"src/bench.rs",
16891633
r#"
@@ -1723,12 +1667,7 @@ fn bench_virtual_manifest_all_implied() {
17231667
"#,
17241668
)
17251669
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
1726-
.file(
1727-
"bar/src/lib.rs",
1728-
r#"
1729-
pub fn foo() {}
1730-
"#,
1731-
)
1670+
.file("bar/src/lib.rs", "pub fn foo() {}")
17321671
.file(
17331672
"bar/benches/bar.rs",
17341673
r#"
@@ -1740,12 +1679,7 @@ fn bench_virtual_manifest_all_implied() {
17401679
"#,
17411680
)
17421681
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
1743-
.file(
1744-
"baz/src/lib.rs",
1745-
r#"
1746-
pub fn baz() {}
1747-
"#,
1748-
)
1682+
.file("baz/src/lib.rs", "pub fn baz() {}")
17491683
.file(
17501684
"baz/benches/baz.rs",
17511685
r#"

0 commit comments

Comments
 (0)