Skip to content

Commit a4e9611

Browse files
committed
Fix some formatting for some strings.
1 parent 0dd7c50 commit a4e9611

21 files changed

+60
-118
lines changed

crates/resolver-tests/tests/resolve.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,8 +1273,7 @@ fn resolving_but_no_exists() {
12731273

12741274
assert_eq!(
12751275
res.err().unwrap().to_string(),
1276-
"\
1277-
no matching package named `foo` found\n\
1276+
"no matching package named `foo` found\n\
12781277
location searched: registry `https://example.com/`\n\
12791278
required by package `root v1.0.0 (registry `https://example.com/`)`\
12801279
"

src/bin/cargo/commands/metadata.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
3131
let version = match args.value_of("format-version") {
3232
None => {
3333
config.shell().warn(
34-
"\
35-
please specify `--format-version` flag explicitly \
34+
"please specify `--format-version` flag explicitly \
3635
to avoid compatibility problems",
3736
)?;
3837
1

src/cargo/core/package.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ impl Package {
204204
let manifest = self.manifest().original().prepare_for_publish(config)?;
205205
let toml = toml::to_string(&manifest)?;
206206
Ok(format!(
207-
"\
208-
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO\n\
207+
"# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO\n\
209208
#\n\
210209
# When uploading crates to the registry Cargo will automatically\n\
211210
# \"normalize\" Cargo.toml files for maximal compatibility\n\

src/cargo/core/registry.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,7 @@ https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#overridin
387387
continue;
388388
}
389389
let msg = format!(
390-
"\
391-
path override for crate `{}` has altered the original list of\n\
390+
"path override for crate `{}` has altered the original list of\n\
392391
dependencies; the dependency on `{}` was either added or\n\
393392
modified to not match the previously resolved version\n\n\
394393
{}",
@@ -402,10 +401,9 @@ https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#overridin
402401

403402
if let Some(dep) = real_deps.get(0) {
404403
let msg = format!(
405-
"\
406-
path override for crate `{}` has altered the original list of
407-
dependencies; the dependency on `{}` was removed\n\n
408-
{}",
404+
"path override for crate `{}` has altered the original list of\n\
405+
dependencies; the dependency on `{}` was removed\n\n\
406+
{}",
409407
override_summary.package_id().name(),
410408
dep.package_name(),
411409
boilerplate

src/cargo/ops/registry.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,7 @@ fn transmit(
269269
Ok(warnings) => {
270270
if !warnings.invalid_categories.is_empty() {
271271
let msg = format!(
272-
"\
273-
the following are not valid category slugs and were \
272+
"the following are not valid category slugs and were \
274273
ignored: {}. Please see https://crates.io/category_slugs \
275274
for the list of all category slugs. \
276275
",
@@ -281,8 +280,7 @@ fn transmit(
281280

282281
if !warnings.invalid_badges.is_empty() {
283282
let msg = format!(
284-
"\
285-
the following are not valid badges and were ignored: {}. \
283+
"the following are not valid badges and were ignored: {}. \
286284
Either the badge type specified is unknown or a required \
287285
attribute is missing. Please see \
288286
https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata \

src/cargo/sources/directory.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ impl<'cfg> Source for DirectorySource<'cfg> {
176176
.finish_hex();
177177
if &*actual != cksum {
178178
failure::bail!(
179-
"\
180-
the listed checksum of `{}` has changed:\n\
179+
"the listed checksum of `{}` has changed:\n\
181180
expected: {}\n\
182181
actual: {}\n\
183182
\n\

src/cargo/util/command_prelude.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ pub trait AppExt: Sized {
152152
self._arg(
153153
opt(
154154
"vcs",
155-
"\
156-
Initialize a new repository for the given version \
155+
"Initialize a new repository for the given version \
157156
control system (git, hg, pijul, or fossil) or do not \
158157
initialize any version control at all (none), overriding \
159158
a global configuration.",

src/cargo/util/diagnostic_server.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ use crate::util::{Config, ProcessBuilder};
1818

1919
const DIAGNOSICS_SERVER_VAR: &str = "__CARGO_FIX_DIAGNOSTICS_SERVER";
2020
const PLEASE_REPORT_THIS_BUG: &str =
21-
"\
22-
This likely indicates a bug in either rustc or cargo itself,\n\
21+
"This likely indicates a bug in either rustc or cargo itself,\n\
2322
and we would appreciate a bug report! You're likely to see \n\
2423
a number of compiler warnings after this message which cargo\n\
2524
attempted to fix but failed. If you could open an issue at\n\

tests/testsuite/bad_config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,8 +1149,7 @@ fn ignored_git_revision() {
11491149
foo.cargo("build -v")
11501150
.with_status(101)
11511151
.with_stderr_contains(
1152-
"\
1153-
[WARNING] key `branch` is ignored for dependency (bar). \
1152+
"[WARNING] key `branch` is ignored for dependency (bar). \
11541153
This will be considered an error in future versions",
11551154
)
11561155
.run();

tests/testsuite/build.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4249,20 +4249,17 @@ fn targets_selected_default() {
42494249
p.cargo("build -v")
42504250
// Binaries.
42514251
.with_stderr_contains(
4252-
"\
4253-
[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
4252+
"[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
42544253
--emit=[..]link[..]",
42554254
)
42564255
// Benchmarks.
42574256
.with_stderr_does_not_contain(
4258-
"\
4259-
[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
4257+
"[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
42604258
-C opt-level=3 --test [..]",
42614259
)
42624260
// Unit tests.
42634261
.with_stderr_does_not_contain(
4264-
"\
4265-
[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
4262+
"[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
42664263
-C debuginfo=2 --test [..]",
42674264
)
42684265
.run();
@@ -4274,14 +4271,12 @@ fn targets_selected_all() {
42744271
p.cargo("build -v --all-targets")
42754272
// Binaries.
42764273
.with_stderr_contains(
4277-
"\
4278-
[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
4274+
"[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
42794275
--emit=[..]link[..]",
42804276
)
42814277
// Unit tests.
42824278
.with_stderr_contains(
4283-
"\
4284-
[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
4279+
"[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
42854280
-C debuginfo=2 --test [..]",
42864281
)
42874282
.run();
@@ -4293,14 +4288,12 @@ fn all_targets_no_lib() {
42934288
p.cargo("build -v --all-targets")
42944289
// Binaries.
42954290
.with_stderr_contains(
4296-
"\
4297-
[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
4291+
"[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
42984292
--emit=[..]link[..]",
42994293
)
43004294
// Unit tests.
43014295
.with_stderr_contains(
4302-
"\
4303-
[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
4296+
"[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
43044297
-C debuginfo=2 --test [..]",
43054298
)
43064299
.run();
@@ -4337,8 +4330,7 @@ fn no_linkable_target() {
43374330
.build();
43384331
p.cargo("build")
43394332
.with_stderr_contains(
4340-
"\
4341-
[WARNING] The package `the_lib` provides no linkable [..] \
4333+
"[WARNING] The package `the_lib` provides no linkable [..] \
43424334
while compiling `foo`. [..] in `the_lib`'s Cargo.toml. [..]",
43434335
)
43444336
.run();

tests/testsuite/build_auth.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ fn http_auth_offered() {
2929
let mut conn = BufStream::new(server.accept().unwrap().0);
3030
let req = headers(&mut conn);
3131
conn.write_all(
32-
b"\
33-
HTTP/1.1 401 Unauthorized\r\n\
34-
WWW-Authenticate: Basic realm=\"wheee\"\r\n
35-
\r\n\
36-
",
32+
b"HTTP/1.1 401 Unauthorized\r\n\
33+
WWW-Authenticate: Basic realm=\"wheee\"\r\n\
34+
\r\n",
3735
)
3836
.unwrap();
3937
assert_eq!(
@@ -51,11 +49,9 @@ fn http_auth_offered() {
5149
let mut conn = BufStream::new(server.accept().unwrap().0);
5250
let req = headers(&mut conn);
5351
conn.write_all(
54-
b"\
55-
HTTP/1.1 401 Unauthorized\r\n\
56-
WWW-Authenticate: Basic realm=\"wheee\"\r\n
57-
\r\n\
58-
",
52+
b"HTTP/1.1 401 Unauthorized\r\n\
53+
WWW-Authenticate: Basic realm=\"wheee\"\r\n\
54+
\r\n",
5955
)
6056
.unwrap();
6157
assert_eq!(
@@ -117,10 +113,9 @@ fn http_auth_offered() {
117113
.file("src/main.rs", "")
118114
.file(
119115
".cargo/config",
120-
"\
121-
[net]
122-
retry = 0
123-
",
116+
"[net]
117+
retry = 0
118+
",
124119
)
125120
.build();
126121

@@ -183,10 +178,9 @@ fn https_something_happens() {
183178
.file("src/main.rs", "")
184179
.file(
185180
".cargo/config",
186-
"\
187-
[net]
188-
retry = 0
189-
",
181+
"[net]
182+
retry = 0
183+
",
190184
)
191185
.build();
192186

tests/testsuite/build_script.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ fn custom_build_script_wrong_rustc_flags() {
189189
p.cargo("build")
190190
.with_status(101)
191191
.with_stderr_contains(
192-
"\
193-
[ERROR] Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 ([CWD])`: \
192+
"[ERROR] Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 ([CWD])`: \
194193
`-aaa -bbb`",
195194
)
196195
.run();

tests/testsuite/cross_compile.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,7 @@ fn build_script_needed_for_host_and_target() {
793793
host = host
794794
))
795795
.with_stderr_contains(&format!(
796-
"\
797-
[RUNNING] `rustc [..] src/main.rs [..] --target {target} [..] \
796+
"[RUNNING] `rustc [..] src/main.rs [..] --target {target} [..] \
798797
-L /path/to/{target}`",
799798
target = target
800799
))

tests/testsuite/features.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,35 +1400,23 @@ fn combining_features_and_package() {
14001400
p.cargo("build -Z package-features --all --features main")
14011401
.masquerade_as_nightly_cargo()
14021402
.with_status(101)
1403-
.with_stderr_contains(
1404-
"\
1405-
[ERROR] cannot specify features for more than one package",
1406-
)
1403+
.with_stderr_contains("[ERROR] cannot specify features for more than one package")
14071404
.run();
14081405

14091406
p.cargo("build -Z package-features --package dep --features main")
14101407
.masquerade_as_nightly_cargo()
14111408
.with_status(101)
1412-
.with_stderr_contains(
1413-
"\
1414-
[ERROR] cannot specify features for packages outside of workspace",
1415-
)
1409+
.with_stderr_contains("[ERROR] cannot specify features for packages outside of workspace")
14161410
.run();
14171411
p.cargo("build -Z package-features --package dep --all-features")
14181412
.masquerade_as_nightly_cargo()
14191413
.with_status(101)
1420-
.with_stderr_contains(
1421-
"\
1422-
[ERROR] cannot specify features for packages outside of workspace",
1423-
)
1414+
.with_stderr_contains("[ERROR] cannot specify features for packages outside of workspace")
14241415
.run();
14251416
p.cargo("build -Z package-features --package dep --no-default-features")
14261417
.masquerade_as_nightly_cargo()
14271418
.with_status(101)
1428-
.with_stderr_contains(
1429-
"\
1430-
[ERROR] cannot specify features for packages outside of workspace",
1431-
)
1419+
.with_stderr_contains("[ERROR] cannot specify features for packages outside of workspace")
14321420
.run();
14331421

14341422
p.cargo("build -Z package-features --all --all-features")

tests/testsuite/fix.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ fn broken_fixes_backed_out() {
141141
.env("__CARGO_FIX_YOLO", "1")
142142
.env("RUSTC", p.root().join("foo/target/debug/foo"))
143143
.with_stderr_contains(
144-
"\
145-
warning: failed to automatically apply fixes suggested by rustc \
144+
"warning: failed to automatically apply fixes suggested by rustc \
146145
to crate `bar`\n\
147146
\n\
148147
after fixes were automatically applied the compiler reported \
@@ -517,8 +516,7 @@ fn preserve_line_endings() {
517516
let p = project()
518517
.file(
519518
"src/lib.rs",
520-
"\
521-
fn add(a: &u32) -> u32 { a + 1 }\r\n\
519+
"fn add(a: &u32) -> u32 { a + 1 }\r\n\
522520
pub fn foo() -> u32 { let mut x = 3; add(&x) }\r\n\
523521
",
524522
)
@@ -535,9 +533,8 @@ fn fix_deny_warnings() {
535533
let p = project()
536534
.file(
537535
"src/lib.rs",
538-
"\
539-
#![deny(warnings)]
540-
pub fn foo() { let mut x = 3; drop(x); }
536+
"#![deny(warnings)]
537+
pub fn foo() { let mut x = 3; drop(x); }
541538
",
542539
)
543540
.build();
@@ -703,8 +700,7 @@ fn warns_if_no_vcs_detected() {
703700
p.cargo("fix")
704701
.with_status(101)
705702
.with_stderr(
706-
"\
707-
error: no VCS found for this package and `cargo fix` can potentially perform \
703+
"error: no VCS found for this package and `cargo fix` can potentially perform \
708704
destructive changes; if you'd like to suppress this error pass `--allow-no-vcs`\
709705
",
710706
)

tests/testsuite/install.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,9 @@ fn install_location_precedence() {
204204
.unwrap()
205205
.write_all(
206206
format!(
207-
"\
208-
[install]
209-
root = '{}'
210-
",
207+
"[install]
208+
root = '{}'
209+
",
211210
t3.display()
212211
)
213212
.as_bytes(),
@@ -822,8 +821,7 @@ fn uninstall_cwd() {
822821
p.cargo("uninstall")
823822
.with_stdout("")
824823
.with_stderr(&format!(
825-
"\
826-
[REMOVING] {home}/bin/foo[EXE]",
824+
"[REMOVING] {home}/bin/foo[EXE]",
827825
home = cargo_home().display()
828826
))
829827
.run();
@@ -836,10 +834,7 @@ fn uninstall_cwd_not_installed() {
836834
p.cargo("uninstall")
837835
.with_status(101)
838836
.with_stdout("")
839-
.with_stderr(
840-
"\
841-
error: package `foo v0.0.1 ([CWD])` is not installed",
842-
)
837+
.with_stderr("error: package `foo v0.0.1 ([CWD])` is not installed")
843838
.run();
844839
}
845840

0 commit comments

Comments
 (0)