Skip to content

Commit

Permalink
Auto merge of #7129 - ehuss:string-reformat, r=Eh2406
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
bors committed Jul 14, 2019
2 parents 0dd7c50 + a4e9611 commit 705009e
Show file tree
Hide file tree
Showing 21 changed files with 60 additions and 118 deletions.
3 changes: 1 addition & 2 deletions crates/resolver-tests/tests/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1273,8 +1273,7 @@ fn resolving_but_no_exists() {

assert_eq!(
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\
required by package `root v1.0.0 (registry `https://example.com/`)`\
"
Expand Down
3 changes: 1 addition & 2 deletions src/bin/cargo/commands/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
let version = match args.value_of("format-version") {
None => {
config.shell().warn(
"\
please specify `--format-version` flag explicitly \
"please specify `--format-version` flag explicitly \
to avoid compatibility problems",
)?;
1
Expand Down
3 changes: 1 addition & 2 deletions src/cargo/core/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ impl Package {
let manifest = self.manifest().original().prepare_for_publish(config)?;
let toml = toml::to_string(&manifest)?;
Ok(format!(
"\
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO\n\
"# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO\n\
#\n\
# When uploading crates to the registry Cargo will automatically\n\
# \"normalize\" Cargo.toml files for maximal compatibility\n\
Expand Down
10 changes: 4 additions & 6 deletions src/cargo/core/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,7 @@ https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#overridin
continue;
}
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\
modified to not match the previously resolved version\n\n\
{}",
Expand All @@ -402,10 +401,9 @@ https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#overridin

if let Some(dep) = real_deps.get(0) {
let msg = format!(
"\
path override for crate `{}` has altered the original list of
dependencies; the dependency on `{}` was removed\n\n
{}",
"path override for crate `{}` has altered the original list of\n\
dependencies; the dependency on `{}` was removed\n\n\
{}",
override_summary.package_id().name(),
dep.package_name(),
boilerplate
Expand Down
6 changes: 2 additions & 4 deletions src/cargo/ops/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ fn transmit(
Ok(warnings) => {
if !warnings.invalid_categories.is_empty() {
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 \
for the list of all category slugs. \
",
Expand All @@ -281,8 +280,7 @@ fn transmit(

if !warnings.invalid_badges.is_empty() {
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 \
attribute is missing. Please see \
https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata \
Expand Down
3 changes: 1 addition & 2 deletions src/cargo/sources/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ impl<'cfg> Source for DirectorySource<'cfg> {
.finish_hex();
if &*actual != cksum {
failure::bail!(
"\
the listed checksum of `{}` has changed:\n\
"the listed checksum of `{}` has changed:\n\
expected: {}\n\
actual: {}\n\
\n\
Expand Down
3 changes: 1 addition & 2 deletions src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ pub trait AppExt: Sized {
self._arg(
opt(
"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 \
initialize any version control at all (none), overriding \
a global configuration.",
Expand Down
3 changes: 1 addition & 2 deletions src/cargo/util/diagnostic_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ use crate::util::{Config, ProcessBuilder};

const DIAGNOSICS_SERVER_VAR: &str = "__CARGO_FIX_DIAGNOSTICS_SERVER";
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\
a number of compiler warnings after this message which cargo\n\
attempted to fix but failed. If you could open an issue at\n\
Expand Down
3 changes: 1 addition & 2 deletions tests/testsuite/bad_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,8 +1149,7 @@ fn ignored_git_revision() {
foo.cargo("build -v")
.with_status(101)
.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",
)
.run();
Expand Down
24 changes: 8 additions & 16 deletions tests/testsuite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4249,20 +4249,17 @@ fn targets_selected_default() {
p.cargo("build -v")
// Binaries.
.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[..]",
)
// Benchmarks.
.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 [..]",
)
// Unit tests.
.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 [..]",
)
.run();
Expand All @@ -4274,14 +4271,12 @@ fn targets_selected_all() {
p.cargo("build -v --all-targets")
// Binaries.
.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[..]",
)
// Unit tests.
.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 [..]",
)
.run();
Expand All @@ -4293,14 +4288,12 @@ fn all_targets_no_lib() {
p.cargo("build -v --all-targets")
// Binaries.
.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[..]",
)
// Unit tests.
.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 [..]",
)
.run();
Expand Down Expand Up @@ -4337,8 +4330,7 @@ fn no_linkable_target() {
.build();
p.cargo("build")
.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. [..]",
)
.run();
Expand Down
30 changes: 12 additions & 18 deletions tests/testsuite/build_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ fn http_auth_offered() {
let mut conn = BufStream::new(server.accept().unwrap().0);
let req = headers(&mut conn);
conn.write_all(
b"\
HTTP/1.1 401 Unauthorized\r\n\
WWW-Authenticate: Basic realm=\"wheee\"\r\n
\r\n\
",
b"HTTP/1.1 401 Unauthorized\r\n\
WWW-Authenticate: Basic realm=\"wheee\"\r\n\
\r\n",
)
.unwrap();
assert_eq!(
Expand All @@ -51,11 +49,9 @@ fn http_auth_offered() {
let mut conn = BufStream::new(server.accept().unwrap().0);
let req = headers(&mut conn);
conn.write_all(
b"\
HTTP/1.1 401 Unauthorized\r\n\
WWW-Authenticate: Basic realm=\"wheee\"\r\n
\r\n\
",
b"HTTP/1.1 401 Unauthorized\r\n\
WWW-Authenticate: Basic realm=\"wheee\"\r\n\
\r\n",
)
.unwrap();
assert_eq!(
Expand Down Expand Up @@ -117,10 +113,9 @@ fn http_auth_offered() {
.file("src/main.rs", "")
.file(
".cargo/config",
"\
[net]
retry = 0
",
"[net]
retry = 0
",
)
.build();

Expand Down Expand Up @@ -183,10 +178,9 @@ fn https_something_happens() {
.file("src/main.rs", "")
.file(
".cargo/config",
"\
[net]
retry = 0
",
"[net]
retry = 0
",
)
.build();

Expand Down
3 changes: 1 addition & 2 deletions tests/testsuite/build_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ fn custom_build_script_wrong_rustc_flags() {
p.cargo("build")
.with_status(101)
.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`",
)
.run();
Expand Down
3 changes: 1 addition & 2 deletions tests/testsuite/cross_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,7 @@ fn build_script_needed_for_host_and_target() {
host = host
))
.with_stderr_contains(&format!(
"\
[RUNNING] `rustc [..] src/main.rs [..] --target {target} [..] \
"[RUNNING] `rustc [..] src/main.rs [..] --target {target} [..] \
-L /path/to/{target}`",
target = target
))
Expand Down
20 changes: 4 additions & 16 deletions tests/testsuite/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1400,35 +1400,23 @@ fn combining_features_and_package() {
p.cargo("build -Z package-features --all --features main")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr_contains(
"\
[ERROR] cannot specify features for more than one package",
)
.with_stderr_contains("[ERROR] cannot specify features for more than one package")
.run();

p.cargo("build -Z package-features --package dep --features main")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr_contains(
"\
[ERROR] cannot specify features for packages outside of workspace",
)
.with_stderr_contains("[ERROR] cannot specify features for packages outside of workspace")
.run();
p.cargo("build -Z package-features --package dep --all-features")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr_contains(
"\
[ERROR] cannot specify features for packages outside of workspace",
)
.with_stderr_contains("[ERROR] cannot specify features for packages outside of workspace")
.run();
p.cargo("build -Z package-features --package dep --no-default-features")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr_contains(
"\
[ERROR] cannot specify features for packages outside of workspace",
)
.with_stderr_contains("[ERROR] cannot specify features for packages outside of workspace")
.run();

p.cargo("build -Z package-features --all --all-features")
Expand Down
14 changes: 5 additions & 9 deletions tests/testsuite/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ fn broken_fixes_backed_out() {
.env("__CARGO_FIX_YOLO", "1")
.env("RUSTC", p.root().join("foo/target/debug/foo"))
.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\
\n\
after fixes were automatically applied the compiler reported \
Expand Down Expand Up @@ -517,8 +516,7 @@ fn preserve_line_endings() {
let p = project()
.file(
"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\
",
)
Expand All @@ -535,9 +533,8 @@ fn fix_deny_warnings() {
let p = project()
.file(
"src/lib.rs",
"\
#![deny(warnings)]
pub fn foo() { let mut x = 3; drop(x); }
"#![deny(warnings)]
pub fn foo() { let mut x = 3; drop(x); }
",
)
.build();
Expand Down Expand Up @@ -703,8 +700,7 @@ fn warns_if_no_vcs_detected() {
p.cargo("fix")
.with_status(101)
.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`\
",
)
Expand Down
15 changes: 5 additions & 10 deletions tests/testsuite/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,9 @@ fn install_location_precedence() {
.unwrap()
.write_all(
format!(
"\
[install]
root = '{}'
",
"[install]
root = '{}'
",
t3.display()
)
.as_bytes(),
Expand Down Expand Up @@ -822,8 +821,7 @@ fn uninstall_cwd() {
p.cargo("uninstall")
.with_stdout("")
.with_stderr(&format!(
"\
[REMOVING] {home}/bin/foo[EXE]",
"[REMOVING] {home}/bin/foo[EXE]",
home = cargo_home().display()
))
.run();
Expand All @@ -836,10 +834,7 @@ fn uninstall_cwd_not_installed() {
p.cargo("uninstall")
.with_status(101)
.with_stdout("")
.with_stderr(
"\
error: package `foo v0.0.1 ([CWD])` is not installed",
)
.with_stderr("error: package `foo v0.0.1 ([CWD])` is not installed")
.run();
}

Expand Down
Loading

0 comments on commit 705009e

Please sign in to comment.