Auto merge of #7129 - ehuss:string-reformat, r=Eh2406

Fix some formatting for some strings.

Some of these strings were formatted in a strange way by rustfmt.

Also fixed some strings missing trailing backslashes.  Specifically, the "path override for crate" string, and the strings in `http_auth_offered`.
This commit is contained in:
bors 2019-07-14 01:54:15 +00:00
commit 705009eb38
21 changed files with 60 additions and 118 deletions

View File

@ -1273,8 +1273,7 @@ fn resolving_but_no_exists() {
assert_eq!( assert_eq!(
res.err().unwrap().to_string(), res.err().unwrap().to_string(),
"\ "no matching package named `foo` found\n\
no matching package named `foo` found\n\
location searched: registry `https://example.com/`\n\ location searched: registry `https://example.com/`\n\
required by package `root v1.0.0 (registry `https://example.com/`)`\ required by package `root v1.0.0 (registry `https://example.com/`)`\
" "

View File

@ -31,8 +31,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
let version = match args.value_of("format-version") { let version = match args.value_of("format-version") {
None => { None => {
config.shell().warn( config.shell().warn(
"\ "please specify `--format-version` flag explicitly \
please specify `--format-version` flag explicitly \
to avoid compatibility problems", to avoid compatibility problems",
)?; )?;
1 1

View File

@ -204,8 +204,7 @@ impl Package {
let manifest = self.manifest().original().prepare_for_publish(config)?; let manifest = self.manifest().original().prepare_for_publish(config)?;
let toml = toml::to_string(&manifest)?; let toml = toml::to_string(&manifest)?;
Ok(format!( Ok(format!(
"\ "# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO\n\
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO\n\
#\n\ #\n\
# When uploading crates to the registry Cargo will automatically\n\ # When uploading crates to the registry Cargo will automatically\n\
# \"normalize\" Cargo.toml files for maximal compatibility\n\ # \"normalize\" Cargo.toml files for maximal compatibility\n\

View File

@ -387,8 +387,7 @@ https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#overridin
continue; continue;
} }
let msg = format!( let msg = format!(
"\ "path override for crate `{}` has altered the original list of\n\
path override for crate `{}` has altered the original list of\n\
dependencies; the dependency on `{}` was either added or\n\ dependencies; the dependency on `{}` was either added or\n\
modified to not match the previously resolved version\n\n\ modified to not match the previously resolved version\n\n\
{}", {}",
@ -402,9 +401,8 @@ https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#overridin
if let Some(dep) = real_deps.get(0) { if let Some(dep) = real_deps.get(0) {
let msg = format!( let msg = format!(
"\ "path override for crate `{}` has altered the original list of\n\
path override for crate `{}` has altered the original list of dependencies; the dependency on `{}` was removed\n\n\
dependencies; the dependency on `{}` was removed\n\n
{}", {}",
override_summary.package_id().name(), override_summary.package_id().name(),
dep.package_name(), dep.package_name(),

View File

@ -269,8 +269,7 @@ fn transmit(
Ok(warnings) => { Ok(warnings) => {
if !warnings.invalid_categories.is_empty() { if !warnings.invalid_categories.is_empty() {
let msg = format!( let msg = format!(
"\ "the following are not valid category slugs and were \
the following are not valid category slugs and were \
ignored: {}. Please see https://crates.io/category_slugs \ ignored: {}. Please see https://crates.io/category_slugs \
for the list of all category slugs. \ for the list of all category slugs. \
", ",
@ -281,8 +280,7 @@ fn transmit(
if !warnings.invalid_badges.is_empty() { if !warnings.invalid_badges.is_empty() {
let msg = format!( let msg = format!(
"\ "the following are not valid badges and were ignored: {}. \
the following are not valid badges and were ignored: {}. \
Either the badge type specified is unknown or a required \ Either the badge type specified is unknown or a required \
attribute is missing. Please see \ attribute is missing. Please see \
https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata \ https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata \

View File

@ -176,8 +176,7 @@ impl<'cfg> Source for DirectorySource<'cfg> {
.finish_hex(); .finish_hex();
if &*actual != cksum { if &*actual != cksum {
failure::bail!( failure::bail!(
"\ "the listed checksum of `{}` has changed:\n\
the listed checksum of `{}` has changed:\n\
expected: {}\n\ expected: {}\n\
actual: {}\n\ actual: {}\n\
\n\ \n\

View File

@ -152,8 +152,7 @@ pub trait AppExt: Sized {
self._arg( self._arg(
opt( opt(
"vcs", "vcs",
"\ "Initialize a new repository for the given version \
Initialize a new repository for the given version \
control system (git, hg, pijul, or fossil) or do not \ control system (git, hg, pijul, or fossil) or do not \
initialize any version control at all (none), overriding \ initialize any version control at all (none), overriding \
a global configuration.", a global configuration.",

View File

@ -18,8 +18,7 @@ use crate::util::{Config, ProcessBuilder};
const DIAGNOSICS_SERVER_VAR: &str = "__CARGO_FIX_DIAGNOSTICS_SERVER"; const DIAGNOSICS_SERVER_VAR: &str = "__CARGO_FIX_DIAGNOSTICS_SERVER";
const PLEASE_REPORT_THIS_BUG: &str = const PLEASE_REPORT_THIS_BUG: &str =
"\ "This likely indicates a bug in either rustc or cargo itself,\n\
This likely indicates a bug in either rustc or cargo itself,\n\
and we would appreciate a bug report! You're likely to see \n\ and we would appreciate a bug report! You're likely to see \n\
a number of compiler warnings after this message which cargo\n\ a number of compiler warnings after this message which cargo\n\
attempted to fix but failed. If you could open an issue at\n\ attempted to fix but failed. If you could open an issue at\n\

View File

@ -1149,8 +1149,7 @@ fn ignored_git_revision() {
foo.cargo("build -v") foo.cargo("build -v")
.with_status(101) .with_status(101)
.with_stderr_contains( .with_stderr_contains(
"\ "[WARNING] key `branch` is ignored for dependency (bar). \
[WARNING] key `branch` is ignored for dependency (bar). \
This will be considered an error in future versions", This will be considered an error in future versions",
) )
.run(); .run();

View File

@ -4249,20 +4249,17 @@ fn targets_selected_default() {
p.cargo("build -v") p.cargo("build -v")
// Binaries. // Binaries.
.with_stderr_contains( .with_stderr_contains(
"\ "[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
--emit=[..]link[..]", --emit=[..]link[..]",
) )
// Benchmarks. // Benchmarks.
.with_stderr_does_not_contain( .with_stderr_does_not_contain(
"\ "[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
-C opt-level=3 --test [..]", -C opt-level=3 --test [..]",
) )
// Unit tests. // Unit tests.
.with_stderr_does_not_contain( .with_stderr_does_not_contain(
"\ "[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
-C debuginfo=2 --test [..]", -C debuginfo=2 --test [..]",
) )
.run(); .run();
@ -4274,14 +4271,12 @@ fn targets_selected_all() {
p.cargo("build -v --all-targets") p.cargo("build -v --all-targets")
// Binaries. // Binaries.
.with_stderr_contains( .with_stderr_contains(
"\ "[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
--emit=[..]link[..]", --emit=[..]link[..]",
) )
// Unit tests. // Unit tests.
.with_stderr_contains( .with_stderr_contains(
"\ "[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
-C debuginfo=2 --test [..]", -C debuginfo=2 --test [..]",
) )
.run(); .run();
@ -4293,14 +4288,12 @@ fn all_targets_no_lib() {
p.cargo("build -v --all-targets") p.cargo("build -v --all-targets")
// Binaries. // Binaries.
.with_stderr_contains( .with_stderr_contains(
"\ "[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
--emit=[..]link[..]", --emit=[..]link[..]",
) )
// Unit tests. // Unit tests.
.with_stderr_contains( .with_stderr_contains(
"\ "[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
-C debuginfo=2 --test [..]", -C debuginfo=2 --test [..]",
) )
.run(); .run();
@ -4337,8 +4330,7 @@ fn no_linkable_target() {
.build(); .build();
p.cargo("build") p.cargo("build")
.with_stderr_contains( .with_stderr_contains(
"\ "[WARNING] The package `the_lib` provides no linkable [..] \
[WARNING] The package `the_lib` provides no linkable [..] \
while compiling `foo`. [..] in `the_lib`'s Cargo.toml. [..]", while compiling `foo`. [..] in `the_lib`'s Cargo.toml. [..]",
) )
.run(); .run();

View File

@ -29,11 +29,9 @@ fn http_auth_offered() {
let mut conn = BufStream::new(server.accept().unwrap().0); let mut conn = BufStream::new(server.accept().unwrap().0);
let req = headers(&mut conn); let req = headers(&mut conn);
conn.write_all( conn.write_all(
b"\ b"HTTP/1.1 401 Unauthorized\r\n\
HTTP/1.1 401 Unauthorized\r\n\ WWW-Authenticate: Basic realm=\"wheee\"\r\n\
WWW-Authenticate: Basic realm=\"wheee\"\r\n \r\n",
\r\n\
",
) )
.unwrap(); .unwrap();
assert_eq!( assert_eq!(
@ -51,11 +49,9 @@ fn http_auth_offered() {
let mut conn = BufStream::new(server.accept().unwrap().0); let mut conn = BufStream::new(server.accept().unwrap().0);
let req = headers(&mut conn); let req = headers(&mut conn);
conn.write_all( conn.write_all(
b"\ b"HTTP/1.1 401 Unauthorized\r\n\
HTTP/1.1 401 Unauthorized\r\n\ WWW-Authenticate: Basic realm=\"wheee\"\r\n\
WWW-Authenticate: Basic realm=\"wheee\"\r\n \r\n",
\r\n\
",
) )
.unwrap(); .unwrap();
assert_eq!( assert_eq!(
@ -117,8 +113,7 @@ fn http_auth_offered() {
.file("src/main.rs", "") .file("src/main.rs", "")
.file( .file(
".cargo/config", ".cargo/config",
"\ "[net]
[net]
retry = 0 retry = 0
", ",
) )
@ -183,8 +178,7 @@ fn https_something_happens() {
.file("src/main.rs", "") .file("src/main.rs", "")
.file( .file(
".cargo/config", ".cargo/config",
"\ "[net]
[net]
retry = 0 retry = 0
", ",
) )

View File

@ -189,8 +189,7 @@ fn custom_build_script_wrong_rustc_flags() {
p.cargo("build") p.cargo("build")
.with_status(101) .with_status(101)
.with_stderr_contains( .with_stderr_contains(
"\ "[ERROR] Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 ([CWD])`: \
[ERROR] Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 ([CWD])`: \
`-aaa -bbb`", `-aaa -bbb`",
) )
.run(); .run();

View File

@ -793,8 +793,7 @@ fn build_script_needed_for_host_and_target() {
host = host host = host
)) ))
.with_stderr_contains(&format!( .with_stderr_contains(&format!(
"\ "[RUNNING] `rustc [..] src/main.rs [..] --target {target} [..] \
[RUNNING] `rustc [..] src/main.rs [..] --target {target} [..] \
-L /path/to/{target}`", -L /path/to/{target}`",
target = target target = target
)) ))

View File

@ -1400,35 +1400,23 @@ fn combining_features_and_package() {
p.cargo("build -Z package-features --all --features main") p.cargo("build -Z package-features --all --features main")
.masquerade_as_nightly_cargo() .masquerade_as_nightly_cargo()
.with_status(101) .with_status(101)
.with_stderr_contains( .with_stderr_contains("[ERROR] cannot specify features for more than one package")
"\
[ERROR] cannot specify features for more than one package",
)
.run(); .run();
p.cargo("build -Z package-features --package dep --features main") p.cargo("build -Z package-features --package dep --features main")
.masquerade_as_nightly_cargo() .masquerade_as_nightly_cargo()
.with_status(101) .with_status(101)
.with_stderr_contains( .with_stderr_contains("[ERROR] cannot specify features for packages outside of workspace")
"\
[ERROR] cannot specify features for packages outside of workspace",
)
.run(); .run();
p.cargo("build -Z package-features --package dep --all-features") p.cargo("build -Z package-features --package dep --all-features")
.masquerade_as_nightly_cargo() .masquerade_as_nightly_cargo()
.with_status(101) .with_status(101)
.with_stderr_contains( .with_stderr_contains("[ERROR] cannot specify features for packages outside of workspace")
"\
[ERROR] cannot specify features for packages outside of workspace",
)
.run(); .run();
p.cargo("build -Z package-features --package dep --no-default-features") p.cargo("build -Z package-features --package dep --no-default-features")
.masquerade_as_nightly_cargo() .masquerade_as_nightly_cargo()
.with_status(101) .with_status(101)
.with_stderr_contains( .with_stderr_contains("[ERROR] cannot specify features for packages outside of workspace")
"\
[ERROR] cannot specify features for packages outside of workspace",
)
.run(); .run();
p.cargo("build -Z package-features --all --all-features") p.cargo("build -Z package-features --all --all-features")

View File

@ -141,8 +141,7 @@ fn broken_fixes_backed_out() {
.env("__CARGO_FIX_YOLO", "1") .env("__CARGO_FIX_YOLO", "1")
.env("RUSTC", p.root().join("foo/target/debug/foo")) .env("RUSTC", p.root().join("foo/target/debug/foo"))
.with_stderr_contains( .with_stderr_contains(
"\ "warning: failed to automatically apply fixes suggested by rustc \
warning: failed to automatically apply fixes suggested by rustc \
to crate `bar`\n\ to crate `bar`\n\
\n\ \n\
after fixes were automatically applied the compiler reported \ after fixes were automatically applied the compiler reported \
@ -517,8 +516,7 @@ fn preserve_line_endings() {
let p = project() let p = project()
.file( .file(
"src/lib.rs", "src/lib.rs",
"\ "fn add(a: &u32) -> u32 { a + 1 }\r\n\
fn add(a: &u32) -> u32 { a + 1 }\r\n\
pub fn foo() -> u32 { let mut x = 3; add(&x) }\r\n\ pub fn foo() -> u32 { let mut x = 3; add(&x) }\r\n\
", ",
) )
@ -535,8 +533,7 @@ fn fix_deny_warnings() {
let p = project() let p = project()
.file( .file(
"src/lib.rs", "src/lib.rs",
"\ "#![deny(warnings)]
#![deny(warnings)]
pub fn foo() { let mut x = 3; drop(x); } pub fn foo() { let mut x = 3; drop(x); }
", ",
) )
@ -703,8 +700,7 @@ fn warns_if_no_vcs_detected() {
p.cargo("fix") p.cargo("fix")
.with_status(101) .with_status(101)
.with_stderr( .with_stderr(
"\ "error: no VCS found for this package and `cargo fix` can potentially perform \
error: no VCS found for this package and `cargo fix` can potentially perform \
destructive changes; if you'd like to suppress this error pass `--allow-no-vcs`\ destructive changes; if you'd like to suppress this error pass `--allow-no-vcs`\
", ",
) )

View File

@ -204,8 +204,7 @@ fn install_location_precedence() {
.unwrap() .unwrap()
.write_all( .write_all(
format!( format!(
"\ "[install]
[install]
root = '{}' root = '{}'
", ",
t3.display() t3.display()
@ -822,8 +821,7 @@ fn uninstall_cwd() {
p.cargo("uninstall") p.cargo("uninstall")
.with_stdout("") .with_stdout("")
.with_stderr(&format!( .with_stderr(&format!(
"\ "[REMOVING] {home}/bin/foo[EXE]",
[REMOVING] {home}/bin/foo[EXE]",
home = cargo_home().display() home = cargo_home().display()
)) ))
.run(); .run();
@ -836,10 +834,7 @@ fn uninstall_cwd_not_installed() {
p.cargo("uninstall") p.cargo("uninstall")
.with_status(101) .with_status(101)
.with_stdout("") .with_stdout("")
.with_stderr( .with_stderr("error: package `foo v0.0.1 ([CWD])` is not installed")
"\
error: package `foo v0.0.1 ([CWD])` is not installed",
)
.run(); .run();
} }

View File

@ -137,8 +137,7 @@ fn reserved_name() {
cargo_process("new test") cargo_process("new test")
.with_status(101) .with_status(101)
.with_stderr( .with_stderr(
"\ "[ERROR] The name `test` cannot be used as a crate name\n\
[ERROR] The name `test` cannot be used as a crate name\n\
use --name to override crate name", use --name to override crate name",
) )
.run(); .run();
@ -149,8 +148,7 @@ fn reserved_binary_name() {
cargo_process("new --bin incremental") cargo_process("new --bin incremental")
.with_status(101) .with_status(101)
.with_stderr( .with_stderr(
"\ "[ERROR] The name `incremental` cannot be used as a crate name\n\
[ERROR] The name `incremental` cannot be used as a crate name\n\
use --name to override crate name", use --name to override crate name",
) )
.run(); .run();
@ -161,8 +159,7 @@ fn keyword_name() {
cargo_process("new pub") cargo_process("new pub")
.with_status(101) .with_status(101)
.with_stderr( .with_stderr(
"\ "[ERROR] The name `pub` cannot be used as a crate name\n\
[ERROR] The name `pub` cannot be used as a crate name\n\
use --name to override crate name", use --name to override crate name",
) )
.run(); .run();

View File

@ -295,8 +295,7 @@ fn no_rebuild_dependency() {
// Don't compile bar, but do recompile foo. // Don't compile bar, but do recompile foo.
p.cargo("build") p.cargo("build")
.with_stderr( .with_stderr(
"\ "[COMPILING] foo v0.5.0 ([..])\n\
[COMPILING] foo v0.5.0 ([..])\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \ [FINISHED] dev [unoptimized + debuginfo] target(s) \
in [..]\n", in [..]\n",
) )

View File

@ -797,8 +797,7 @@ fn run_from_executable_folder() {
p.cargo("run") p.cargo("run")
.cwd(cwd) .cwd(cwd)
.with_stderr( .with_stderr(
"\ "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]\n\
[RUNNING] `./foo[EXE]`", [RUNNING] `./foo[EXE]`",
) )
.with_stdout("hello") .with_stdout("hello")

View File

@ -232,20 +232,17 @@ fn targets_selected_default() {
p.cargo("rustc -v") p.cargo("rustc -v")
// bin // bin
.with_stderr_contains( .with_stderr_contains(
"\ "[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
--emit=[..]link[..]", --emit=[..]link[..]",
) )
// bench // bench
.with_stderr_does_not_contain( .with_stderr_does_not_contain(
"\ "[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
-C opt-level=3 --test [..]", -C opt-level=3 --test [..]",
) )
// unit test // unit test
.with_stderr_does_not_contain( .with_stderr_does_not_contain(
"\ "[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
-C debuginfo=2 --test [..]", -C debuginfo=2 --test [..]",
) )
.run(); .run();
@ -257,14 +254,12 @@ fn targets_selected_all() {
p.cargo("rustc -v --all-targets") p.cargo("rustc -v --all-targets")
// bin // bin
.with_stderr_contains( .with_stderr_contains(
"\ "[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \
--emit=[..]link[..]", --emit=[..]link[..]",
) )
// unit test // unit test
.with_stderr_contains( .with_stderr_contains(
"\ "[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
[RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \
-C debuginfo=2 --test [..]", -C debuginfo=2 --test [..]",
) )
.run(); .run();

View File

@ -224,7 +224,7 @@ fn custom_runner_cfg_precedence() {
.with_status(101) .with_status(101)
.with_stderr_contains( .with_stderr_contains(
"\ "\
[COMPILING] foo v0.0.1 ([CWD]) [COMPILING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `nonexistent-runner -r target/debug/foo[EXE] --param` [RUNNING] `nonexistent-runner -r target/debug/foo[EXE] --param`
", ",