From 63a9c7aa6d54ff0580288f1a01795a29b3ea1c75 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Thu, 2 May 2019 06:39:15 +0900 Subject: [PATCH] $cargo fmt --all --- src/cargo/core/compiler/build_context/mod.rs | 4 +- src/cargo/core/compiler/fingerprint.rs | 8 +++- src/cargo/core/compiler/mod.rs | 20 +++++---- src/cargo/core/resolver/resolve.rs | 44 +++++++++++------- src/cargo/core/workspace.rs | 2 +- src/cargo/ops/cargo_compile.rs | 4 +- src/cargo/ops/cargo_package.rs | 9 +++- src/cargo/ops/registry.rs | 10 +++-- src/cargo/ops/resolve.rs | 2 +- src/cargo/sources/registry/mod.rs | 4 +- src/cargo/util/config.rs | 24 +++++----- src/cargo/util/progress.rs | 3 +- src/cargo/util/to_url_with_base.rs | 37 ++++++++------- src/cargo/util/toml/mod.rs | 2 +- tests/testsuite/alt_registry.rs | 47 +++++++++++--------- tests/testsuite/freshness.rs | 15 ++----- tests/testsuite/offline.rs | 2 +- tests/testsuite/pub_priv.rs | 1 - tests/testsuite/search.rs | 8 ++-- tests/testsuite/support/paths.rs | 4 +- 20 files changed, 141 insertions(+), 109 deletions(-) diff --git a/src/cargo/core/compiler/build_context/mod.rs b/src/cargo/core/compiler/build_context/mod.rs index 9b55fedb88c..8cd60c80e7f 100644 --- a/src/cargo/core/compiler/build_context/mod.rs +++ b/src/cargo/core/compiler/build_context/mod.rs @@ -4,13 +4,13 @@ use std::str; use log::debug; +use crate::core::compiler::unit::UnitInterner; +use crate::core::compiler::{BuildConfig, BuildOutput, Kind, Unit}; use crate::core::profiles::Profiles; use crate::core::{Dependency, Workspace}; use crate::core::{PackageId, PackageSet, Resolve}; use crate::util::errors::CargoResult; use crate::util::{profile, Cfg, Config, Rustc}; -use crate::core::compiler::{Unit, Kind, BuildConfig, BuildOutput}; -use crate::core::compiler::unit::UnitInterner; mod target_info; pub use self::target_info::{FileFlavor, TargetInfo}; diff --git a/src/cargo/core/compiler/fingerprint.rs b/src/cargo/core/compiler/fingerprint.rs index d760b112aad..6fb86cca94f 100644 --- a/src/cargo/core/compiler/fingerprint.rs +++ b/src/cargo/core/compiler/fingerprint.rs @@ -422,7 +422,13 @@ impl Serialize for DepFingerprint { where S: ser::Serializer, { - (&self.pkg_id, &self.name, &self.public, &self.fingerprint.hash()).serialize(ser) + ( + &self.pkg_id, + &self.name, + &self.public, + &self.fingerprint.hash(), + ) + .serialize(ser) } } diff --git a/src/cargo/core/compiler/mod.rs b/src/cargo/core/compiler/mod.rs index 398b044938a..2072c83a737 100644 --- a/src/cargo/core/compiler/mod.rs +++ b/src/cargo/core/compiler/mod.rs @@ -23,7 +23,6 @@ use log::debug; use same_file::is_same_file; use serde::Serialize; -use crate::core::Feature; pub use self::build_config::{BuildConfig, CompileMode, MessageFormat}; pub use self::build_context::{BuildContext, FileFlavor, TargetConfig, TargetInfo}; use self::build_plan::BuildPlan; @@ -38,6 +37,7 @@ use self::output_depinfo::output_depinfo; pub use crate::core::compiler::unit::{Unit, UnitInterner}; use crate::core::manifest::TargetSourcePath; use crate::core::profiles::{Lto, PanicStrategy, Profile}; +use crate::core::Feature; use crate::core::{PackageId, Target}; use crate::util::errors::{CargoResult, CargoResultExt, Internal, ProcessError}; use crate::util::paths; @@ -984,7 +984,6 @@ fn build_deps_args<'a, 'cfg>( cmd.arg("-Z").arg("unstable-options"); } - return Ok(()); fn link_to<'a, 'cfg>( @@ -992,7 +991,7 @@ fn build_deps_args<'a, 'cfg>( cx: &mut Context<'a, 'cfg>, current: &Unit<'a>, dep: &Unit<'a>, - need_unstable_opts: &mut bool + need_unstable_opts: &mut bool, ) -> CargoResult<()> { let bcx = cx.bcx; for output in cx.outputs(dep)?.iter() { @@ -1007,11 +1006,16 @@ fn build_deps_args<'a, 'cfg>( v.push(&path::MAIN_SEPARATOR.to_string()); v.push(&output.path.file_name().unwrap()); - if current.pkg.manifest().features().require(Feature::public_dependency()).is_ok() && - !bcx.is_public_dependency(current, dep) { - - cmd.arg("--extern-private"); - *need_unstable_opts = true; + if current + .pkg + .manifest() + .features() + .require(Feature::public_dependency()) + .is_ok() + && !bcx.is_public_dependency(current, dep) + { + cmd.arg("--extern-private"); + *need_unstable_opts = true; } else { cmd.arg("--extern"); } diff --git a/src/cargo/core/resolver/resolve.rs b/src/cargo/core/resolver/resolve.rs index a2acb32c755..6a953d00ad8 100644 --- a/src/cargo/core/resolver/resolve.rs +++ b/src/cargo/core/resolver/resolve.rs @@ -5,8 +5,8 @@ use std::iter::FromIterator; use url::Url; -use crate::core::{Dependency, PackageId, PackageIdSpec, Summary, Target}; use crate::core::dependency::Kind; +use crate::core::{Dependency, PackageId, PackageIdSpec, Summary, Target}; use crate::util::errors::CargoResult; use crate::util::Graph; @@ -44,20 +44,29 @@ impl Resolve { unused_patches: Vec, ) -> Resolve { let reverse_replacements = replacements.iter().map(|(&p, &r)| (r, p)).collect(); - let public_dependencies = graph.iter().map(|p| { - let public_deps = graph.edges(p).flat_map(|(dep_package, deps)| { - let id_opt: Option = deps.iter().find(|d| d.kind() == Kind::Normal).and_then(|d| { - if d.is_public() { - Some(dep_package.clone()) - } else { - None - } - }); - id_opt - }).collect::>(); - - (p.clone(), public_deps) - }).collect(); + let public_dependencies = graph + .iter() + .map(|p| { + let public_deps = graph + .edges(p) + .flat_map(|(dep_package, deps)| { + let id_opt: Option = deps + .iter() + .find(|d| d.kind() == Kind::Normal) + .and_then(|d| { + if d.is_public() { + Some(dep_package.clone()) + } else { + None + } + }); + id_opt + }) + .collect::>(); + + (p.clone(), public_deps) + }) + .collect(); Resolve { graph, @@ -68,7 +77,7 @@ impl Resolve { unused_patches, empty_features: HashSet::new(), reverse_replacements, - public_dependencies + public_dependencies, } } @@ -217,7 +226,8 @@ unable to verify that `{0}` is the same as when the lockfile was generated } pub fn is_public_dep(&self, pkg: PackageId, dep: PackageId) -> bool { - self.public_dependencies.get(&pkg) + self.public_dependencies + .get(&pkg) .map(|public_deps| public_deps.contains(&dep)) .unwrap_or_else(|| panic!("Unknown dependency {:?} for package {:?}", dep, pkg)) } diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs index 304e6f86fa7..aa1da9afd64 100644 --- a/src/cargo/core/workspace.rs +++ b/src/cargo/core/workspace.rs @@ -11,7 +11,7 @@ use url::Url; use crate::core::features::Features; use crate::core::profiles::Profiles; use crate::core::registry::PackageRegistry; -use crate::core::{Dependency, PackageIdSpec, PackageId}; +use crate::core::{Dependency, PackageId, PackageIdSpec}; use crate::core::{EitherManifest, Package, SourceId, VirtualManifest}; use crate::ops; use crate::sources::PathSource; diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index ffe7cef5557..fceab742505 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -697,7 +697,9 @@ fn generate_targets<'a>( } => { if *lib != LibRule::False { let mut libs = Vec::new(); - for proposal in filter_targets(packages, Target::is_lib, false, bcx.build_config.mode) { + for proposal in + filter_targets(packages, Target::is_lib, false, bcx.build_config.mode) + { let Proposal { target, pkg, .. } = proposal; if bcx.build_config.mode == CompileMode::Doctest && !target.doctestable() { ws.config().shell().warn(format!( diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index f38f21c8dcb..87ce0816a0c 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -15,10 +15,10 @@ use termcolor::Color; use crate::core::compiler::{BuildConfig, CompileMode, DefaultExecutor, Executor}; use crate::core::resolver::Method; +use crate::core::Feature; use crate::core::{ Package, PackageId, PackageIdSpec, PackageSet, Resolve, Source, SourceId, Verbosity, Workspace, }; -use crate::core::Feature; use crate::ops; use crate::sources::PathSource; use crate::util::errors::{CargoResult, CargoResultExt}; @@ -591,7 +591,12 @@ fn run_verify(ws: &Workspace<'_>, tar: &FileLock, opts: &PackageOpts<'_>) -> Car let pkg_fingerprint = hash_all(&dst)?; let ws = Workspace::ephemeral(new_pkg, config, None, true)?; - let rustc_args = if pkg.manifest().features().require(Feature::public_dependency()).is_ok() { + let rustc_args = if pkg + .manifest() + .features() + .require(Feature::public_dependency()) + .is_ok() + { // FIXME: Turn this on at some point in the future //Some(vec!["-D exported_private_dependencies".to_string()]) None diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index 873a43832b1..83d97121b8e 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -69,7 +69,7 @@ pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> { opts.index.clone(), opts.registry.clone(), true, - !opts.dry_run + !opts.dry_run, )?; verify_dependencies(pkg, ®istry, reg_id)?; @@ -326,7 +326,9 @@ pub fn registry_configuration( None => { // Checking for default index and token ( - config.get_default_registry_index()?.map(|url| url.to_string()), + config + .get_default_registry_index()? + .map(|url| url.to_string()), config.get_string("registry.token")?.map(|p| p.val), ) } @@ -341,7 +343,7 @@ fn registry( index: Option, registry: Option, force_update: bool, - validate_token: bool + validate_token: bool, ) -> CargoResult<(Registry, SourceId)> { // Parse all configuration options let RegistryConfig { @@ -609,7 +611,7 @@ pub fn modify_owners(config: &Config, opts: &OwnersOptions) -> CargoResult<()> { opts.index.clone(), opts.registry.clone(), true, - true + true, )?; if let Some(ref v) = opts.to_add { diff --git a/src/cargo/ops/resolve.rs b/src/cargo/ops/resolve.rs index 8f6fa8e0811..be273026caa 100644 --- a/src/cargo/ops/resolve.rs +++ b/src/cargo/ops/resolve.rs @@ -3,9 +3,9 @@ use std::rc::Rc; use log::{debug, trace}; -use crate::core::Feature; use crate::core::registry::PackageRegistry; use crate::core::resolver::{self, Method, Resolve}; +use crate::core::Feature; use crate::core::{PackageId, PackageIdSpec, PackageSet, Source, SourceId, Workspace}; use crate::ops; use crate::sources::PathSource; diff --git a/src/cargo/sources/registry/mod.rs b/src/cargo/sources/registry/mod.rs index e4c2d027474..fb4bf5fcf49 100644 --- a/src/cargo/sources/registry/mod.rs +++ b/src/cargo/sources/registry/mod.rs @@ -285,7 +285,7 @@ struct RegistryDependency<'a> { kind: Option>, registry: Option>, package: Option>, - public: Option + public: Option, } impl<'a> RegistryDependency<'a> { @@ -301,7 +301,7 @@ impl<'a> RegistryDependency<'a> { kind, registry, package, - public + public, } = self; let id = if let Some(registry) = ®istry { diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index 4494b9ca307..b2014dda8d3 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -29,8 +29,8 @@ use crate::util::errors::{self, internal, CargoResult, CargoResultExt}; use crate::util::toml as cargo_toml; use crate::util::Filesystem; use crate::util::Rustc; -use crate::util::{ToUrl, ToUrlWithBase}; use crate::util::{paths, validate_package_name}; +use crate::util::{ToUrl, ToUrlWithBase}; /// Configuration information for cargo. This is not specific to a build, it is information /// relating to cargo itself. @@ -275,9 +275,9 @@ impl Config { } pub fn updated_sources(&self) -> RefMut<'_, HashSet> { - self.updated_sources.borrow_with(|| { - RefCell::new(HashSet::new()) - }).borrow_mut() + self.updated_sources + .borrow_with(|| RefCell::new(HashSet::new())) + .borrow_mut() } pub fn values(&self) -> CargoResult<&HashMap> { @@ -675,16 +675,17 @@ impl Config { /// Gets the index for the default registry. pub fn get_default_registry_index(&self) -> CargoResult> { - Ok( - match self.get_string("registry.index")? { - Some(index) => Some(self.resolve_registry_index(index)?), - None => None, - }, - ) + Ok(match self.get_string("registry.index")? { + Some(index) => Some(self.resolve_registry_index(index)?), + None => None, + }) } fn resolve_registry_index(&self, index: Value) -> CargoResult { - let base = index.definition.root(&self).join("truncated-by-url_with_base"); + let base = index + .definition + .root(&self) + .join("truncated-by-url_with_base"); // Parse val to check it is a URL, not a relative path without a protocol. let _parsed = index.val.to_url()?; let url = index.val.to_url_with_base(Some(&*base))?; @@ -1663,4 +1664,3 @@ pub fn save_credentials(cfg: &Config, token: String, registry: Option) - Ok(()) } } - diff --git a/src/cargo/util/progress.rs b/src/cargo/util/progress.rs index a7279627849..69b9aad0fb5 100644 --- a/src/cargo/util/progress.rs +++ b/src/cargo/util/progress.rs @@ -356,7 +356,8 @@ fn test_progress_status() { ); // combining diacritics have width zero and thus can fit max_width. - let zalgo_msg = "z̸̧̢̗͉̝̦͍̱ͧͦͨ̑̅̌ͥ́͢a̢ͬͨ̽ͯ̅̑ͥ͋̏̑ͫ̄͢͏̫̝̪̤͎̱̣͍̭̞̙̱͙͍̘̭͚l̶̡̛̥̝̰̭̹̯̯̞̪͇̱̦͙͔̘̼͇͓̈ͨ͗ͧ̓͒ͦ̀̇ͣ̈ͭ͊͛̃̑͒̿̕͜g̸̷̢̩̻̻͚̠͓̞̥͐ͩ͌̑ͥ̊̽͋͐̐͌͛̐̇̑ͨ́ͅo͙̳̣͔̰̠̜͕͕̞̦̙̭̜̯̹̬̻̓͑ͦ͋̈̉͌̃ͯ̀̂͠ͅ ̸̡͎̦̲̖̤̺̜̮̱̰̥͔̯̅̏ͬ̂ͨ̋̃̽̈́̾̔̇ͣ̚͜͜h̡ͫ̐̅̿̍̀͜҉̛͇̭̹̰̠͙̞ẽ̶̙̹̳̖͉͎̦͂̋̓ͮ̔ͬ̐̀͂̌͑̒͆̚͜͠ ͓͓̟͍̮̬̝̝̰͓͎̼̻ͦ͐̾̔͒̃̓͟͟c̮̦͍̺͈͚̯͕̄̒͐̂͊̊͗͊ͤͣ̀͘̕͝͞o̶͍͚͍̣̮͌ͦ̽̑ͩ̅ͮ̐̽̏͗́͂̅ͪ͠m̷̧͖̻͔̥̪̭͉͉̤̻͖̩̤͖̘ͦ̂͌̆̂ͦ̒͊ͯͬ͊̉̌ͬ͝͡e̵̹̣͍̜̺̤̤̯̫̹̠̮͎͙̯͚̰̼͗͐̀̒͂̉̀̚͝͞s̵̲͍͙͖̪͓͓̺̱̭̩̣͖̣ͤͤ͂̎̈͗͆ͨͪ̆̈͗͝͠"; + let zalgo_msg = + "z̸̧̢̗͉̝̦͍̱ͧͦͨ̑̅̌ͥ́͢a̢ͬͨ̽ͯ̅̑ͥ͋̏̑ͫ̄͢͏̫̝̪̤͎̱̣͍̭̞̙̱͙͍̘̭͚l̶̡̛̥̝̰̭̹̯̯̞̪͇̱̦͙͔̘̼͇͓̈ͨ͗ͧ̓͒ͦ̀̇ͣ̈ͭ͊͛̃̑͒̿̕͜g̸̷̢̩̻̻͚̠͓̞̥͐ͩ͌̑ͥ̊̽͋͐̐͌͛̐̇̑ͨ́ͅo͙̳̣͔̰̠̜͕͕̞̦̙̭̜̯̹̬̻̓͑ͦ͋̈̉͌̃ͯ̀̂͠ͅ ̸̡͎̦̲̖̤̺̜̮̱̰̥͔̯̅̏ͬ̂ͨ̋̃̽̈́̾̔̇ͣ̚͜͜h̡ͫ̐̅̿̍̀͜҉̛͇̭̹̰̠͙̞ẽ̶̙̹̳̖͉͎̦͂̋̓ͮ̔ͬ̐̀͂̌͑̒͆̚͜͠ ͓͓̟͍̮̬̝̝̰͓͎̼̻ͦ͐̾̔͒̃̓͟͟c̮̦͍̺͈͚̯͕̄̒͐̂͊̊͗͊ͤͣ̀͘̕͝͞o̶͍͚͍̣̮͌ͦ̽̑ͩ̅ͮ̐̽̏͗́͂̅ͪ͠m̷̧͖̻͔̥̪̭͉͉̤̻͖̩̤͖̘ͦ̂͌̆̂ͦ̒͊ͯͬ͊̉̌ͬ͝͡e̵̹̣͍̜̺̤̤̯̫̹̠̮͎͙̯͚̰̼͗͐̀̒͂̉̀̚͝͞s̵̲͍͙͖̪͓͓̺̱̭̩̣͖̣ͤͤ͂̎̈͗͆ͨͪ̆̈͗͝͠"; assert_eq!( format.progress_status(3, 4, zalgo_msg), Some("[=============> ] 3/4".to_string() + zalgo_msg) diff --git a/src/cargo/util/to_url_with_base.rs b/src/cargo/util/to_url_with_base.rs index de2d4f7442f..5f71f0c0f7f 100644 --- a/src/cargo/util/to_url_with_base.rs +++ b/src/cargo/util/to_url_with_base.rs @@ -12,18 +12,17 @@ pub trait ToUrlWithBase { impl<'a> ToUrlWithBase for &'a str { fn to_url_with_base(self, base: Option) -> CargoResult { let base_url = match base { - Some(base) => - Some(base.to_url().map_err(|s| { - failure::format_err!("invalid url `{}`: {}", self, s) - })?), - None => None + Some(base) => Some( + base.to_url() + .map_err(|s| failure::format_err!("invalid url `{}`: {}", self, s))?, + ), + None => None, }; Url::options() .base_url(base_url.as_ref()) - .parse(self).map_err(|s| { - failure::format_err!("invalid url `{}`: {}", self, s) - }) + .parse(self) + .map_err(|s| failure::format_err!("invalid url `{}`: {}", self, s)) } } @@ -33,13 +32,19 @@ mod tests { #[test] fn to_url_with_base() { - assert_eq!("rel/path".to_url_with_base(Some("file:///abs/path/")) - .unwrap() - .to_string(), - "file:///abs/path/rel/path"); - assert_eq!("rel/path".to_url_with_base(Some("file:///abs/path/popped-file")) - .unwrap() - .to_string(), - "file:///abs/path/rel/path"); + assert_eq!( + "rel/path" + .to_url_with_base(Some("file:///abs/path/")) + .unwrap() + .to_string(), + "file:///abs/path/rel/path" + ); + assert_eq!( + "rel/path" + .to_url_with_base(Some("file:///abs/path/popped-file")) + .unwrap() + .to_string(), + "file:///abs/path/rel/path" + ); } } diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index bb540abbe20..13ed058ace6 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -239,7 +239,7 @@ pub struct DetailedTomlDependency { #[serde(rename = "default_features")] default_features2: Option, package: Option, - public: Option + public: Option, } #[derive(Debug, Deserialize, Serialize)] diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs index 0f5491836ef..cd4fde5a888 100644 --- a/tests/testsuite/alt_registry.rs +++ b/tests/testsuite/alt_registry.rs @@ -1170,11 +1170,15 @@ fn unknown_registry() { fn registries_index_relative_url() { let config = paths::root().join(".cargo/config"); fs::create_dir_all(config.parent().unwrap()).unwrap(); - File::create(&config).unwrap() - .write_all(br#" + File::create(&config) + .unwrap() + .write_all( + br#" [registries.relative] index = "file:alternative-registry" - "#).unwrap(); + "#, + ) + .unwrap(); registry::init(); @@ -1195,9 +1199,7 @@ fn registries_index_relative_url() { .file("src/main.rs", "fn main() {}") .build(); - Package::new("bar", "0.0.1") - .alternative(true) - .publish(); + Package::new("bar", "0.0.1").alternative(true).publish(); p.cargo("build") .with_stderr(&format!( @@ -1218,11 +1220,15 @@ fn registries_index_relative_url() { fn registry_index_relative_url() { let config = paths::root().join(".cargo/config"); fs::create_dir_all(config.parent().unwrap()).unwrap(); - File::create(&config).unwrap() - .write_all(br#" + File::create(&config) + .unwrap() + .write_all( + br#" [registry] index = "file:alternative-registry" - "#).unwrap(); + "#, + ) + .unwrap(); registry::init(); @@ -1242,9 +1248,7 @@ fn registry_index_relative_url() { .file("src/main.rs", "fn main() {}") .build(); - Package::new("bar", "0.0.1") - .alternative(true) - .publish(); + Package::new("bar", "0.0.1").alternative(true).publish(); fs::remove_file(paths::home().join(".cargo/config")).unwrap(); @@ -1268,11 +1272,15 @@ warning: custom registry support via the `registry.index` configuration is being fn registries_index_relative_path_not_allowed() { let config = paths::root().join(".cargo/config"); fs::create_dir_all(config.parent().unwrap()).unwrap(); - File::create(&config).unwrap() - .write_all(br#" + File::create(&config) + .unwrap() + .write_all( + br#" [registries.relative] index = "alternative-registry" - "#).unwrap(); + "#, + ) + .unwrap(); registry::init(); @@ -1293,9 +1301,7 @@ fn registries_index_relative_path_not_allowed() { .file("src/main.rs", "fn main() {}") .build(); - Package::new("bar", "0.0.1") - .alternative(true) - .publish(); + Package::new("bar", "0.0.1").alternative(true).publish(); p.cargo("build") .with_stderr(&format!( @@ -1304,8 +1310,9 @@ error: failed to parse manifest at `{root}/foo/Cargo.toml` Caused by: invalid url `alternative-registry`: relative URL without a base -" - , root = paths::root().to_str().unwrap())) +", + root = paths::root().to_str().unwrap() + )) .with_status(101) .run(); } diff --git a/tests/testsuite/freshness.rs b/tests/testsuite/freshness.rs index 76c10a71655..0909313e219 100644 --- a/tests/testsuite/freshness.rs +++ b/tests/testsuite/freshness.rs @@ -1983,10 +1983,7 @@ fn rename_with_path_deps() { a = { path = 'a' } "#, ) - .file( - "src/lib.rs", - "extern crate a; pub fn foo() { a::foo(); }", - ) + .file("src/lib.rs", "extern crate a; pub fn foo() { a::foo(); }") .file( "a/Cargo.toml", r#" @@ -1999,10 +1996,7 @@ fn rename_with_path_deps() { b = { path = 'b' } "#, ) - .file( - "a/src/lib.rs", - "extern crate b; pub fn foo() { b::foo() }", - ) + .file("a/src/lib.rs", "extern crate b; pub fn foo() { b::foo() }") .file( "a/b/Cargo.toml", r#" @@ -2012,10 +2006,7 @@ fn rename_with_path_deps() { authors = [] "#, ) - .file( - "a/b/src/lib.rs", - "pub fn foo() { }", - ); + .file("a/b/src/lib.rs", "pub fn foo() { }"); let p = p.build(); p.cargo("build").run(); diff --git a/tests/testsuite/offline.rs b/tests/testsuite/offline.rs index 91653135d66..69588647348 100644 --- a/tests/testsuite/offline.rs +++ b/tests/testsuite/offline.rs @@ -521,7 +521,7 @@ fn offline_resolve_optional_fail() { // Change dep to 2.0. p.change_file( "Cargo.toml", - r#" + r#" [package] name = "foo" version = "0.1.0" diff --git a/tests/testsuite/pub_priv.rs b/tests/testsuite/pub_priv.rs index 894f7775661..d98812f1b18 100644 --- a/tests/testsuite/pub_priv.rs +++ b/tests/testsuite/pub_priv.rs @@ -160,7 +160,6 @@ consider adding `cargo-features = [\"public-dependency\"]` to the manifest .run() } - #[test] fn pub_dev_dependency() { Package::new("pub_dep", "0.1.0") diff --git a/tests/testsuite/search.rs b/tests/testsuite/search.rs index e0f7f4807ec..cb6f2174898 100644 --- a/tests/testsuite/search.rs +++ b/tests/testsuite/search.rs @@ -112,11 +112,9 @@ fn not_update() { regsrc.update().unwrap(); cargo_process("search postgres") - .with_stdout_contains( - "hoare = \"0.1.1\" # Design by contract style assertions for Rust", - ) - .with_stderr("") // without "Updating ... index" - .run(); + .with_stdout_contains("hoare = \"0.1.1\" # Design by contract style assertions for Rust") + .with_stderr("") // without "Updating ... index" + .run(); } #[test] diff --git a/tests/testsuite/support/paths.rs b/tests/testsuite/support/paths.rs index 0b7120e2556..cdc3e541e47 100644 --- a/tests/testsuite/support/paths.rs +++ b/tests/testsuite/support/paths.rs @@ -146,7 +146,9 @@ impl CargoPathExt for Path { } fn is_symlink(&self) -> bool { - fs::symlink_metadata(self).map(|m| m.file_type().is_symlink()).unwrap_or(false) + fs::symlink_metadata(self) + .map(|m| m.file_type().is_symlink()) + .unwrap_or(false) } }