diff --git a/crates/resolver-tests/tests/resolve.rs b/crates/resolver-tests/tests/resolve.rs index 5f2790c6afc..1fd59d3c149 100644 --- a/crates/resolver-tests/tests/resolve.rs +++ b/crates/resolver-tests/tests/resolve.rs @@ -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/`)`\ " diff --git a/src/bin/cargo/commands/metadata.rs b/src/bin/cargo/commands/metadata.rs index 5add91db09a..a6deee86717 100644 --- a/src/bin/cargo/commands/metadata.rs +++ b/src/bin/cargo/commands/metadata.rs @@ -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 diff --git a/src/cargo/core/package.rs b/src/cargo/core/package.rs index 0c089b90178..01a9864cec9 100644 --- a/src/cargo/core/package.rs +++ b/src/cargo/core/package.rs @@ -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\ diff --git a/src/cargo/core/registry.rs b/src/cargo/core/registry.rs index 5471bd90326..1d1839a0cda 100644 --- a/src/cargo/core/registry.rs +++ b/src/cargo/core/registry.rs @@ -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\ {}", @@ -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 diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index a24d4a5fbc8..3831ed07a23 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -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. \ ", @@ -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 \ diff --git a/src/cargo/sources/directory.rs b/src/cargo/sources/directory.rs index 06f668f4db0..fa27ecea0bb 100644 --- a/src/cargo/sources/directory.rs +++ b/src/cargo/sources/directory.rs @@ -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\ diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index b8f208ea3e3..4ac3a06166a 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -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.", diff --git a/src/cargo/util/diagnostic_server.rs b/src/cargo/util/diagnostic_server.rs index b00d4ac334c..237536dd0b7 100644 --- a/src/cargo/util/diagnostic_server.rs +++ b/src/cargo/util/diagnostic_server.rs @@ -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\ diff --git a/tests/testsuite/bad_config.rs b/tests/testsuite/bad_config.rs index 504d05d8055..e6dd6610ece 100644 --- a/tests/testsuite/bad_config.rs +++ b/tests/testsuite/bad_config.rs @@ -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(); diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 13bb5b85a0b..59ed086708d 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -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(); @@ -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(); @@ -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(); @@ -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(); diff --git a/tests/testsuite/build_auth.rs b/tests/testsuite/build_auth.rs index 5a3098b63e6..c2b59585be1 100644 --- a/tests/testsuite/build_auth.rs +++ b/tests/testsuite/build_auth.rs @@ -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!( @@ -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!( @@ -117,10 +113,9 @@ fn http_auth_offered() { .file("src/main.rs", "") .file( ".cargo/config", - "\ - [net] - retry = 0 - ", + "[net] + retry = 0 + ", ) .build(); @@ -183,10 +178,9 @@ fn https_something_happens() { .file("src/main.rs", "") .file( ".cargo/config", - "\ - [net] - retry = 0 - ", + "[net] + retry = 0 + ", ) .build(); diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index 1351adbafac..0952033bacc 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -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(); diff --git a/tests/testsuite/cross_compile.rs b/tests/testsuite/cross_compile.rs index a619c48f010..c725c1a01e2 100644 --- a/tests/testsuite/cross_compile.rs +++ b/tests/testsuite/cross_compile.rs @@ -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 )) diff --git a/tests/testsuite/features.rs b/tests/testsuite/features.rs index 9c2c3aae9bf..aa65127ad58 100644 --- a/tests/testsuite/features.rs +++ b/tests/testsuite/features.rs @@ -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") diff --git a/tests/testsuite/fix.rs b/tests/testsuite/fix.rs index 748d1df9b8d..6b6153f5d2e 100644 --- a/tests/testsuite/fix.rs +++ b/tests/testsuite/fix.rs @@ -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 \ @@ -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\ ", ) @@ -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(); @@ -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`\ ", ) diff --git a/tests/testsuite/install.rs b/tests/testsuite/install.rs index 47b9d3b3575..5ebb3018829 100644 --- a/tests/testsuite/install.rs +++ b/tests/testsuite/install.rs @@ -204,10 +204,9 @@ fn install_location_precedence() { .unwrap() .write_all( format!( - "\ - [install] - root = '{}' - ", + "[install] + root = '{}' + ", t3.display() ) .as_bytes(), @@ -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(); @@ -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(); } diff --git a/tests/testsuite/new.rs b/tests/testsuite/new.rs index b578b128e34..ee6408026e4 100644 --- a/tests/testsuite/new.rs +++ b/tests/testsuite/new.rs @@ -137,8 +137,7 @@ fn reserved_name() { cargo_process("new test") .with_status(101) .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", ) .run(); @@ -149,8 +148,7 @@ fn reserved_binary_name() { cargo_process("new --bin incremental") .with_status(101) .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", ) .run(); @@ -161,8 +159,7 @@ fn keyword_name() { cargo_process("new pub") .with_status(101) .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", ) .run(); diff --git a/tests/testsuite/path.rs b/tests/testsuite/path.rs index 066d670dfa8..226668ceb63 100644 --- a/tests/testsuite/path.rs +++ b/tests/testsuite/path.rs @@ -295,8 +295,7 @@ fn no_rebuild_dependency() { // Don't compile bar, but do recompile foo. p.cargo("build") .with_stderr( - "\ - [COMPILING] foo v0.5.0 ([..])\n\ + "[COMPILING] foo v0.5.0 ([..])\n\ [FINISHED] dev [unoptimized + debuginfo] target(s) \ in [..]\n", ) diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index 97261c20bf7..04afa8fc244 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -797,8 +797,7 @@ fn run_from_executable_folder() { p.cargo("run") .cwd(cwd) .with_stderr( - "\ - [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]\n\ + "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]\n\ [RUNNING] `./foo[EXE]`", ) .with_stdout("hello") diff --git a/tests/testsuite/rustc.rs b/tests/testsuite/rustc.rs index e8a4f8103dd..9fb3ad240cc 100644 --- a/tests/testsuite/rustc.rs +++ b/tests/testsuite/rustc.rs @@ -232,20 +232,17 @@ fn targets_selected_default() { p.cargo("rustc -v") // bin .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[..]", ) // bench .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 test .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(); @@ -257,14 +254,12 @@ fn targets_selected_all() { p.cargo("rustc -v --all-targets") // bin .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 test .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(); diff --git a/tests/testsuite/tool_paths.rs b/tests/testsuite/tool_paths.rs index 7124b22cc64..8633871e5c0 100644 --- a/tests/testsuite/tool_paths.rs +++ b/tests/testsuite/tool_paths.rs @@ -224,7 +224,7 @@ fn custom_runner_cfg_precedence() { .with_status(101) .with_stderr_contains( "\ - [COMPILING] foo v0.0.1 ([CWD]) +[COMPILING] foo v0.0.1 ([CWD]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] [RUNNING] `nonexistent-runner -r target/debug/foo[EXE] --param` ",