From 0247dc429ac36787b72a88d586d66acc36f9c8dd Mon Sep 17 00:00:00 2001 From: Eh2406 Date: Fri, 23 Feb 2018 18:27:53 -0500 Subject: [PATCH] intellij rust suggested fixes (cherry picked from commit 24836e9) --- src/bin/bench.rs | 4 +- src/bin/build.rs | 4 +- src/bin/check.rs | 6 +-- src/bin/clean.rs | 2 +- src/bin/doc.rs | 4 +- src/bin/install.rs | 2 +- src/bin/package.rs | 2 +- src/bin/publish.rs | 12 +++--- src/bin/run.rs | 4 +- src/bin/rustc.rs | 4 +- src/bin/rustdoc.rs | 2 +- src/bin/test.rs | 8 ++-- src/bin/update.rs | 2 +- src/cargo/core/manifest.rs | 48 +++++++++++----------- src/cargo/core/package.rs | 8 ++-- src/cargo/core/package_id.rs | 4 +- src/cargo/core/package_id_spec.rs | 6 +-- src/cargo/core/registry.rs | 2 +- src/cargo/core/resolver/encode.rs | 14 +++---- src/cargo/core/source/source_id.rs | 8 ++-- src/cargo/core/workspace.rs | 12 +++--- src/cargo/lib.rs | 2 +- src/cargo/ops/cargo_compile.rs | 20 ++++----- src/cargo/ops/cargo_new.rs | 6 +-- src/cargo/ops/cargo_output_metadata.rs | 6 +-- src/cargo/ops/cargo_package.rs | 2 +- src/cargo/ops/cargo_rustc/compilation.rs | 2 +- src/cargo/ops/cargo_rustc/context.rs | 18 ++++---- src/cargo/ops/cargo_rustc/custom_build.rs | 18 ++++---- src/cargo/ops/cargo_rustc/fingerprint.rs | 4 +- src/cargo/ops/cargo_rustc/job.rs | 2 +- src/cargo/ops/cargo_rustc/job_queue.rs | 4 +- src/cargo/ops/cargo_rustc/layout.rs | 2 +- src/cargo/ops/cargo_rustc/mod.rs | 10 ++--- src/cargo/ops/registry.rs | 6 +-- src/cargo/ops/resolve.rs | 2 +- src/cargo/sources/config.rs | 4 +- src/cargo/sources/directory.rs | 2 +- src/cargo/sources/git/source.rs | 8 ++-- src/cargo/sources/git/utils.rs | 10 ++--- src/cargo/sources/path.rs | 2 +- src/cargo/sources/registry/index.rs | 4 +- src/cargo/sources/registry/local.rs | 2 +- src/cargo/sources/registry/mod.rs | 6 +-- src/cargo/sources/registry/remote.rs | 2 +- src/cargo/util/config.rs | 2 +- src/cargo/util/errors.rs | 6 +-- src/cargo/util/flock.rs | 8 ++-- src/cargo/util/job.rs | 2 +- src/cargo/util/process_builder.rs | 6 +-- src/cargo/util/read2.rs | 2 +- src/cargo/util/rustc.rs | 8 ++-- src/cargo/util/toml/mod.rs | 30 +++++++------- src/crates-io/lib.rs | 10 ++--- tests/testsuite/cargotest/support/git.rs | 2 +- tests/testsuite/cargotest/support/mod.rs | 6 +-- tests/testsuite/cargotest/support/paths.rs | 2 +- tests/testsuite/directory.rs | 2 +- tests/testsuite/generate_lockfile.rs | 6 +-- tests/testsuite/install.rs | 2 +- tests/testsuite/patch.rs | 2 +- 61 files changed, 199 insertions(+), 199 deletions(-) diff --git a/src/bin/bench.rs b/src/bin/bench.rs index e00002ebe..f42e5a73e 100644 --- a/src/bin/bench.rs +++ b/src/bin/bench.rs @@ -121,13 +121,13 @@ pub fn execute(mut options: Options, config: &mut Config) -> CliResult { no_fail_fast: options.flag_no_fail_fast, only_doc: false, compile_opts: ops::CompileOptions { - config: config, + config, jobs: options.flag_jobs, target: options.flag_target.as_ref().map(|s| &s[..]), features: &options.flag_features, all_features: options.flag_all_features, no_default_features: options.flag_no_default_features, - spec: spec, + spec, release: true, mode: ops::CompileMode::Bench, filter: ops::CompileFilter::new(options.flag_lib, diff --git a/src/bin/build.rs b/src/bin/build.rs index 889052068..9dd2fa24e 100644 --- a/src/bin/build.rs +++ b/src/bin/build.rs @@ -105,13 +105,13 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult { &options.flag_package)?; let opts = CompileOptions { - config: config, + config, jobs: options.flag_jobs, target: options.flag_target.as_ref().map(|t| &t[..]), features: &options.flag_features, all_features: options.flag_all_features, no_default_features: options.flag_no_default_features, - spec: spec, + spec, mode: ops::CompileMode::Build, release: options.flag_release, filter: ops::CompileFilter::new(options.flag_lib, diff --git a/src/bin/check.rs b/src/bin/check.rs index 98172a28c..53e8128e1 100644 --- a/src/bin/check.rs +++ b/src/bin/check.rs @@ -121,14 +121,14 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult { }; let opts = CompileOptions { - config: config, + config, jobs: options.flag_jobs, target: options.flag_target.as_ref().map(|t| &t[..]), features: &options.flag_features, all_features: options.flag_all_features, no_default_features: options.flag_no_default_features, - spec: spec, - mode: ops::CompileMode::Check{test:test}, + spec, + mode: ops::CompileMode::Check{test }, release: options.flag_release, filter: ops::CompileFilter::new(options.flag_lib, &options.flag_bin, options.flag_bins, diff --git a/src/bin/clean.rs b/src/bin/clean.rs index 446b5e502..fc226b4ad 100644 --- a/src/bin/clean.rs +++ b/src/bin/clean.rs @@ -56,7 +56,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult { let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?; let opts = ops::CleanOptions { - config: config, + config, spec: &options.flag_package, target: options.flag_target.as_ref().map(|s| &s[..]), release: options.flag_release, diff --git a/src/bin/doc.rs b/src/bin/doc.rs index 6e1783696..8c6b929fe 100644 --- a/src/bin/doc.rs +++ b/src/bin/doc.rs @@ -98,13 +98,13 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult { let doc_opts = ops::DocOptions { open_result: options.flag_open, compile_opts: ops::CompileOptions { - config: config, + config, jobs: options.flag_jobs, target: options.flag_target.as_ref().map(|t| &t[..]), features: &options.flag_features, all_features: options.flag_all_features, no_default_features: options.flag_no_default_features, - spec: spec, + spec, filter: ops::CompileFilter::new(options.flag_lib, &options.flag_bin, options.flag_bins, &empty, false, diff --git a/src/bin/install.rs b/src/bin/install.rs index a0c000202..af18a839c 100644 --- a/src/bin/install.rs +++ b/src/bin/install.rs @@ -118,7 +118,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult { &options.flag_z)?; let compile_opts = ops::CompileOptions { - config: config, + config, jobs: options.flag_jobs, target: None, features: &options.flag_features, diff --git a/src/bin/package.rs b/src/bin/package.rs index 9c91583d0..4db0db86f 100644 --- a/src/bin/package.rs +++ b/src/bin/package.rs @@ -54,7 +54,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult { let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?; let ws = Workspace::new(&root, config)?; ops::package(&ws, &ops::PackageOpts { - config: config, + config, verify: !options.flag_no_verify, list: options.flag_list, check_metadata: !options.flag_no_metadata, diff --git a/src/bin/publish.rs b/src/bin/publish.rs index 7294ea70e..71d7efc53 100644 --- a/src/bin/publish.rs +++ b/src/bin/publish.rs @@ -97,17 +97,17 @@ about this warning."; let root = find_root_manifest_for_wd(flag_manifest_path.clone(), config.cwd())?; let ws = Workspace::new(&root, config)?; ops::publish(&ws, &ops::PublishOpts { - config: config, - token: token, + config, + token, index: if host.clone().is_none() || host.clone().unwrap().is_empty() { index } else { config.shell().warn(&msg)?; host }, // TODO: Deprecated, remove verify: !no_verify, - allow_dirty: allow_dirty, + allow_dirty, target: target.as_ref().map(|t| &t[..]), - jobs: jobs, - dry_run: dry_run, - registry: registry, + jobs, + dry_run, + registry, })?; Ok(()) } diff --git a/src/bin/run.rs b/src/bin/run.rs index 48939d654..92ccb90db 100644 --- a/src/bin/run.rs +++ b/src/bin/run.rs @@ -86,13 +86,13 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult { let spec = Packages::Packages(&packages); let compile_opts = ops::CompileOptions { - config: config, + config, jobs: options.flag_jobs, target: options.flag_target.as_ref().map(|t| &t[..]), features: &options.flag_features, all_features: options.flag_all_features, no_default_features: options.flag_no_default_features, - spec: spec, + spec, release: options.flag_release, mode: ops::CompileMode::Build, filter: if examples.is_empty() && bins.is_empty() { diff --git a/src/bin/rustc.rs b/src/bin/rustc.rs index 98d7c410d..a73e47ddc 100644 --- a/src/bin/rustc.rs +++ b/src/bin/rustc.rs @@ -113,14 +113,14 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult { let spec = options.flag_package.map_or_else(Vec::new, |s| vec![s]); let opts = CompileOptions { - config: config, + config, jobs: options.flag_jobs, target: options.flag_target.as_ref().map(|t| &t[..]), features: &options.flag_features, all_features: options.flag_all_features, no_default_features: options.flag_no_default_features, spec: Packages::Packages(&spec), - mode: mode, + mode, release: options.flag_release, filter: ops::CompileFilter::new(options.flag_lib, &options.flag_bin, options.flag_bins, diff --git a/src/bin/rustdoc.rs b/src/bin/rustdoc.rs index 156a6b867..f10354619 100644 --- a/src/bin/rustdoc.rs +++ b/src/bin/rustdoc.rs @@ -99,7 +99,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult { let doc_opts = ops::DocOptions { open_result: options.flag_open, compile_opts: ops::CompileOptions { - config: config, + config, jobs: options.flag_jobs, target: options.flag_target.as_ref().map(|t| &t[..]), features: &options.flag_features, diff --git a/src/bin/test.rs b/src/bin/test.rs index d13e9edbc..1262894ce 100644 --- a/src/bin/test.rs +++ b/src/bin/test.rs @@ -159,16 +159,16 @@ pub fn execute(mut options: Options, config: &mut Config) -> CliResult { no_fail_fast: options.flag_no_fail_fast, only_doc: options.flag_doc, compile_opts: ops::CompileOptions { - config: config, + config, jobs: options.flag_jobs, target: options.flag_target.as_ref().map(|s| &s[..]), features: &options.flag_features, all_features: options.flag_all_features, no_default_features: options.flag_no_default_features, - spec: spec, + spec, release: options.flag_release, - mode: mode, - filter: filter, + mode, + filter, message_format: options.flag_message_format, target_rustdoc_args: None, target_rustc_args: None, diff --git a/src/bin/update.rs b/src/bin/update.rs index 1e7f92b53..1de78a23e 100644 --- a/src/bin/update.rs +++ b/src/bin/update.rs @@ -74,7 +74,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult { aggressive: options.flag_aggressive, precise: options.flag_precise.as_ref().map(|s| &s[..]), to_update: &options.flag_package, - config: config, + config, }; let ws = Workspace::new(&root, config)?; diff --git a/src/cargo/core/manifest.rs b/src/cargo/core/manifest.rs index ab90cee09..0ebe5f533 100644 --- a/src/cargo/core/manifest.rs +++ b/src/cargo/core/manifest.rs @@ -275,22 +275,22 @@ impl Manifest { im_a_teapot: Option, original: Rc) -> Manifest { Manifest { - summary: summary, - targets: targets, + summary, + targets, warnings: Vec::new(), - exclude: exclude, - include: include, - links: links, - metadata: metadata, - profiles: profiles, - publish: publish, - replace: replace, - patch: patch, - workspace: workspace, - features: features, - epoch: epoch, - original: original, - im_a_teapot: im_a_teapot, + exclude, + include, + links, + metadata, + profiles, + publish, + replace, + patch, + workspace, + features, + epoch, + original, + im_a_teapot, } } @@ -372,10 +372,10 @@ impl VirtualManifest { workspace: WorkspaceConfig, profiles: Profiles) -> VirtualManifest { VirtualManifest { - replace: replace, - patch: patch, - workspace: workspace, - profiles: profiles, + replace, + patch, + workspace, + profiles, } } @@ -430,7 +430,7 @@ impl Target { Target { kind: TargetKind::Bin, name: name.to_string(), - required_features: required_features, + required_features, doc: true, ..Target::with_path(src_path) } @@ -459,9 +459,9 @@ impl Target { }; Target { - kind: kind, + kind, name: name.to_string(), - required_features: required_features, + required_features, benched: false, ..Target::with_path(src_path) } @@ -472,7 +472,7 @@ impl Target { Target { kind: TargetKind::Test, name: name.to_string(), - required_features: required_features, + required_features, benched: false, ..Target::with_path(src_path) } @@ -483,7 +483,7 @@ impl Target { Target { kind: TargetKind::Bench, name: name.to_string(), - required_features: required_features, + required_features, tested: false, ..Target::with_path(src_path) } diff --git a/src/cargo/core/package.rs b/src/cargo/core/package.rs index e0c54c03a..252b7ac83 100644 --- a/src/cargo/core/package.rs +++ b/src/cargo/core/package.rs @@ -58,9 +58,9 @@ impl ser::Serialize for Package { name: package_id.name(), version: &package_id.version().to_string(), id: package_id, - license: license, - license_file: license_file, - description: description, + license, + license_file, + description, source: summary.source_id(), dependencies: summary.dependencies(), targets: self.manifest.targets(), @@ -75,7 +75,7 @@ impl Package { pub fn new(manifest: Manifest, manifest_path: &Path) -> Package { Package { - manifest: manifest, + manifest, manifest_path: manifest_path.to_path_buf(), } } diff --git a/src/cargo/core/package_id.rs b/src/cargo/core/package_id.rs index 908798555..ffb4330c6 100644 --- a/src/cargo/core/package_id.rs +++ b/src/cargo/core/package_id.rs @@ -64,8 +64,8 @@ impl<'de> de::Deserialize<'de> for PackageId { Ok(PackageId { inner: Arc::new(PackageIdInner { name: name.to_string(), - version: version, - source_id: source_id, + version, + source_id, }), }) } diff --git a/src/cargo/core/package_id_spec.rs b/src/cargo/core/package_id_spec.rs index 318fc0b3e..be1170be4 100644 --- a/src/cargo/core/package_id_spec.rs +++ b/src/cargo/core/package_id_spec.rs @@ -40,7 +40,7 @@ impl PackageIdSpec { } Ok(PackageIdSpec { name: name.to_string(), - version: version, + version, url: None, }) } @@ -100,8 +100,8 @@ impl PackageIdSpec { } }; Ok(PackageIdSpec { - name: name, - version: version, + name, + version, url: Some(url), }) } diff --git a/src/cargo/core/registry.rs b/src/cargo/core/registry.rs index 1a18bd011..31758f841 100644 --- a/src/cargo/core/registry.rs +++ b/src/cargo/core/registry.rs @@ -110,7 +110,7 @@ impl<'cfg> PackageRegistry<'cfg> { sources: SourceMap::new(), source_ids: HashMap::new(), overrides: Vec::new(), - source_config: source_config, + source_config, locked: HashMap::new(), patches: HashMap::new(), patches_locked: false, diff --git a/src/cargo/core/resolver/encode.rs b/src/cargo/core/resolver/encode.rs index a0cf0bac0..bf985e4c8 100644 --- a/src/cargo/core/resolver/encode.rs +++ b/src/cargo/core/resolver/encode.rs @@ -179,10 +179,10 @@ impl EncodableResolve { graph: g, empty_features: HashSet::new(), features: HashMap::new(), - replacements: replacements, - checksums: checksums, - metadata: metadata, - unused_patches: unused_patches, + replacements, + checksums, + metadata, + unused_patches, }) } } @@ -372,8 +372,8 @@ impl<'a, 'cfg> ser::Serialize for WorkspaceResolve<'a, 'cfg> { EncodableResolve { package: Some(encodable), root: None, - metadata: metadata, - patch: patch, + metadata, + patch, }.serialize(s) } } @@ -399,7 +399,7 @@ fn encodable_resolve_node(id: &PackageId, resolve: &Resolve) version: id.version().to_string(), source: encode_source(id.source_id()), dependencies: deps, - replace: replace, + replace, } } diff --git a/src/cargo/core/source/source_id.rs b/src/cargo/core/source/source_id.rs index 1651f5306..9135af41f 100644 --- a/src/cargo/core/source/source_id.rs +++ b/src/cargo/core/source/source_id.rs @@ -70,9 +70,9 @@ impl SourceId { fn new(kind: Kind, url: Url) -> CargoResult { let source_id = SourceId { inner: Arc::new(SourceIdInner { - kind: kind, + kind, canonical_url: git::canonicalize_url(&url)?, - url: url, + url, precise: None, name: None, }), @@ -191,7 +191,7 @@ impl SourceId { inner: Arc::new(SourceIdInner { kind: Kind::Registry, canonical_url: git::canonicalize_url(&url)?, - url: url, + url, precise: None, name: Some(key.to_string()), }), @@ -524,6 +524,6 @@ mod tests { let foo = Kind::Git(GitReference::Branch("foo".to_string())); let s3 = SourceId::new(foo, loc).unwrap(); - assert!(s1 != s3); + assert_ne!(s1, s3); } } diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs index 5d21dd8d4..63ecc7b3f 100644 --- a/src/cargo/core/workspace.rs +++ b/src/cargo/core/workspace.rs @@ -125,14 +125,14 @@ impl<'cfg> Workspace<'cfg> { let target_dir = config.target_dir()?; let mut ws = Workspace { - config: config, + config, current_manifest: manifest_path.to_path_buf(), packages: Packages { - config: config, + config, packages: HashMap::new(), }, root_manifest: None, - target_dir: target_dir, + target_dir, members: Vec::new(), default_members: Vec::new(), is_ephemeral: false, @@ -162,10 +162,10 @@ impl<'cfg> Workspace<'cfg> { target_dir: Option, require_optional_deps: bool) -> CargoResult> { let mut ws = Workspace { - config: config, + config, current_manifest: package.manifest_path().to_path_buf(), packages: Packages { - config: config, + config, packages: HashMap::new(), }, root_manifest: None, @@ -173,7 +173,7 @@ impl<'cfg> Workspace<'cfg> { members: Vec::new(), default_members: Vec::new(), is_ephemeral: true, - require_optional_deps: require_optional_deps, + require_optional_deps, }; { let key = ws.current_manifest.parent().unwrap(); diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index 41615e3d8..dc1dcd6a5 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -216,7 +216,7 @@ pub fn version() -> VersionInfo { pre_release: option_env_str!("CARGO_PKG_VERSION_PRE"), cfg_info: Some(CfgInfo { release_channel: option_env_str!("CFG_RELEASE_CHANNEL").unwrap(), - commit_info: commit_info, + commit_info, }), } }, diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index cc3400268..026d4fdc6 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -70,14 +70,14 @@ impl<'a> CompileOptions<'a> { pub fn default(config: &'a Config, mode: CompileMode) -> CompileOptions<'a> { CompileOptions { - config: config, + config, jobs: None, target: None, features: &[], all_features: false, no_default_features: false, spec: ops::Packages::Packages(&[]), - mode: mode, + mode, release: false, filter: CompileFilter::Default { required_features_filterable: false }, message_format: MessageFormat::Human, @@ -455,7 +455,7 @@ fn generate_auto_targets<'a>(mode: CompileMode, targets: &'a [Target], targets.iter().filter(|t| t.benched()).map(|t| { BuildProposal { target: t, - profile: profile, + profile, required: !required_features_filterable, } }).collect::>() @@ -489,7 +489,7 @@ fn generate_auto_targets<'a>(mode: CompileMode, targets: &'a [Target], t.is_bin() || t.is_lib() }).map(|t| BuildProposal { target: t, - profile: profile, + profile, required: !required_features_filterable, }).collect() } @@ -501,7 +501,7 @@ fn generate_auto_targets<'a>(mode: CompileMode, targets: &'a [Target], ) }).map(|t| BuildProposal { target: t, - profile: profile, + profile, required: !required_features_filterable, }).collect() } @@ -510,7 +510,7 @@ fn generate_auto_targets<'a>(mode: CompileMode, targets: &'a [Target], if t.doctested() { return vec![BuildProposal { target: t, - profile: profile, + profile, required: !required_features_filterable, }]; } @@ -532,7 +532,7 @@ fn propose_indicated_targets<'a>(pkg: &'a Package, let result = pkg.targets().iter().filter(|t| is_expected_kind(t)).map(|t| { BuildProposal { target: t, - profile: profile, + profile, required: false, } }); @@ -561,7 +561,7 @@ fn propose_indicated_targets<'a>(pkg: &'a Package, debug!("found {} `{}`", desc, name); targets.push(BuildProposal { target: t, - profile: profile, + profile, required: true, }); } @@ -650,7 +650,7 @@ fn generate_targets<'a>(pkg: &'a Package, if let Some(t) = pkg.targets().iter().find(|t| t.is_lib()) { targets.push(BuildProposal { target: t, - profile: profile, + profile, required: true, }); } else if !all_targets { @@ -721,7 +721,7 @@ fn scrape_build_config(config: &Config, let mut base = ops::BuildConfig { host_triple: config.rustc()?.host.clone(), requested_target: target.clone(), - jobs: jobs, + jobs, ..Default::default() }; base.host = scrape_target_config(config, &base.host_triple)?; diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index aaaa69e21..a1291e75b 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -291,7 +291,7 @@ pub fn new(opts: &NewOptions, config: &Config) -> CargoResult<()> { let mkopts = MkOptions { version_control: opts.version_control, path: &path, - name: name, + name, source_files: vec![plan_new_source_file(opts.kind.is_bin(), name.to_string())], bin: opts.kind.is_bin(), }; @@ -580,8 +580,8 @@ fn global_config(config: &Config) -> CargoResult { None => None }; Ok(CargoNewConfig { - name: name, - email: email, + name, + email, version_control: vcs, }) } diff --git a/src/cargo/ops/cargo_output_metadata.rs b/src/cargo/ops/cargo_output_metadata.rs index 1b6da788f..0e4425254 100644 --- a/src/cargo/ops/cargo_output_metadata.rs +++ b/src/cargo/ops/cargo_output_metadata.rs @@ -59,10 +59,10 @@ fn metadata_full(ws: &Workspace, .collect::>>()?; Ok(ExportInfo { - packages: packages, + packages, workspace_members: ws.members().map(|pkg| pkg.package_id().clone()).collect(), resolve: Some(MetadataResolve{ - resolve: resolve, + resolve, root: ws.current_opt().map(|pkg| pkg.package_id().clone()), }), target_directory: ws.target_dir().display().to_string(), @@ -102,7 +102,7 @@ fn serialize_resolve(resolve: &Resolve, s: S) -> Result resolve.iter().map(|id| { Node { - id: id, + id, dependencies: resolve.deps(id).collect(), } }).collect::>().serialize(s) diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index 9562b7aba..0dc3aedd5 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -292,7 +292,7 @@ fn run_verify(ws: &Workspace, tar: &FileLock, opts: &PackageOpts) -> CargoResult let ws = Workspace::ephemeral(new_pkg, config, None, true)?; ops::compile_ws(&ws, None, &ops::CompileOptions { - config: config, + config, jobs: opts.jobs, target: opts.target, features: &[], diff --git a/src/cargo/ops/cargo_rustc/compilation.rs b/src/cargo/ops/cargo_rustc/compilation.rs index 88f82516b..7cb781e0f 100644 --- a/src/cargo/ops/cargo_rustc/compilation.rs +++ b/src/cargo/ops/cargo_rustc/compilation.rs @@ -80,7 +80,7 @@ impl<'cfg> Compilation<'cfg> { to_doc_test: Vec::new(), cfgs: HashMap::new(), rustdocflags: HashMap::new(), - config: config, + config, target: String::new(), target_runner: LazyCell::new(), } diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index 325d74346..24985a190 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -175,26 +175,26 @@ impl<'a, 'cfg> Context<'a, 'cfg> { }; Ok(Context { - ws: ws, + ws, host: host_layout, target: target_layout, - resolve: resolve, - packages: packages, - config: config, + resolve, + packages, + config, target_info: TargetInfo::default(), host_info: TargetInfo::default(), compilation: Compilation::new(config), build_state: Arc::new(BuildState::new(&build_config)), - build_config: build_config, + build_config, fingerprints: HashMap::new(), - profiles: profiles, + profiles, compiled: HashSet::new(), build_scripts: HashMap::new(), build_explicit_deps: HashMap::new(), links: Links::new(), used_in_plugin: HashSet::new(), incremental_env, - jobserver: jobserver, + jobserver, build_script_overridden: HashSet::new(), // TODO: Pre-Calculate these with a topo-sort, rather than lazy-calculating @@ -346,7 +346,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { } let cfg = if has_cfg_and_sysroot { - Some(try!(lines.map(Cfg::from_str).collect())) + Some(lines.map(Cfg::from_str).collect::>()?) } else { None }; @@ -819,7 +819,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { Ok(pkg) => { pkg.targets().iter().find(|t| t.is_lib()).map(|t| { let unit = Unit { - pkg: pkg, + pkg, target: t, profile: self.lib_or_check_profile(unit, t), kind: unit.kind.for_target(t), diff --git a/src/cargo/ops/cargo_rustc/custom_build.rs b/src/cargo/ops/cargo_rustc/custom_build.rs index 95940bfcb..6e7ff4b86 100644 --- a/src/cargo/ops/cargo_rustc/custom_build.rs +++ b/src/cargo/ops/cargo_rustc/custom_build.rs @@ -331,7 +331,7 @@ impl BuildState { } BuildState { outputs: Mutex::new(HashMap::new()), - overrides: overrides, + overrides, } } @@ -416,14 +416,14 @@ impl BuildOutput { } Ok(BuildOutput { - library_paths: library_paths, - library_links: library_links, - cfgs: cfgs, - env: env, - metadata: metadata, - rerun_if_changed: rerun_if_changed, - rerun_if_env_changed: rerun_if_env_changed, - warnings: warnings, + library_paths, + library_links, + cfgs, + env, + metadata, + rerun_if_changed, + rerun_if_env_changed, + warnings, }) } diff --git a/src/cargo/ops/cargo_rustc/fingerprint.rs b/src/cargo/ops/cargo_rustc/fingerprint.rs index 3080cee3d..fa4005486 100644 --- a/src/cargo/ops/cargo_rustc/fingerprint.rs +++ b/src/cargo/ops/cargo_rustc/fingerprint.rs @@ -419,7 +419,7 @@ fn calculate<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) // actually affect the output artifact so there's no need to hash it. path: util::hash_u64(&super::path_args(cx, unit).0), features: format!("{:?}", cx.resolve.features_sorted(unit.pkg.package_id())), - deps: deps, + deps, local: vec![local], memoized_hash: Mutex::new(None), epoch: unit.pkg.manifest().epoch(), @@ -473,7 +473,7 @@ pub fn prepare_build_cmd<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) path: 0, features: String::new(), deps: Vec::new(), - local: local, + local, memoized_hash: Mutex::new(None), epoch: Epoch::Epoch2015, rustflags: Vec::new(), diff --git a/src/cargo/ops/cargo_rustc/job.rs b/src/cargo/ops/cargo_rustc/job.rs index 219a6d437..cb49d07d8 100644 --- a/src/cargo/ops/cargo_rustc/job.rs +++ b/src/cargo/ops/cargo_rustc/job.rs @@ -47,7 +47,7 @@ impl Work { impl Job { /// Create a new job representing a unit of work. pub fn new(dirty: Work, fresh: Work) -> Job { - Job { dirty: dirty, fresh: fresh } + Job { dirty, fresh } } /// Consumes this job by running it, returning the result of the diff --git a/src/cargo/ops/cargo_rustc/job_queue.rs b/src/cargo/ops/cargo_rustc/job_queue.rs index 281f057ab..6613404cd 100644 --- a/src/cargo/ops/cargo_rustc/job_queue.rs +++ b/src/cargo/ops/cargo_rustc/job_queue.rs @@ -81,8 +81,8 @@ impl<'a> JobQueue<'a> { let (tx, rx) = channel(); JobQueue { queue: DependencyQueue::new(), - tx: tx, - rx: rx, + tx, + rx, active: 0, pending: HashMap::new(), compiled: HashSet::new(), diff --git a/src/cargo/ops/cargo_rustc/layout.rs b/src/cargo/ops/cargo_rustc/layout.rs index c5a6b875d..23a7490d9 100644 --- a/src/cargo/ops/cargo_rustc/layout.rs +++ b/src/cargo/ops/cargo_rustc/layout.rs @@ -117,7 +117,7 @@ impl Layout { incremental: root.join("incremental"), fingerprint: root.join(".fingerprint"), examples: root.join("examples"), - root: root, + root, _lock: lock, }) } diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index ec97e81b2..6cfb6e1e4 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -149,9 +149,9 @@ pub fn compile_targets<'a, 'cfg: 'a>(ws: &Workspace<'cfg>, }; targets.iter().map(move |&(target, profile)| { Unit { - pkg: pkg, - target: target, - profile: profile, + pkg, + target, + profile, kind: if target.for_host() {Kind::Host} else {default_kind}, } }) @@ -576,9 +576,9 @@ fn link_targets<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, package_id: &package_id, target: &target, profile: &profile, - features: features, + features, filenames: destinations, - fresh: fresh, + fresh, }); } Ok(()) diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index daf80a624..5f29d3e5e 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -180,7 +180,7 @@ fn transmit(config: &Config, let publish = registry.publish(&NewCrate { name: pkg.name().to_string(), vers: pkg.version().to_string(), - deps: deps, + deps, features: pkg.summary().features().clone(), authors: authors.clone(), description: description.clone(), @@ -241,8 +241,8 @@ pub fn registry_configuration(config: &Config, }; Ok(RegistryConfig { - index: index, - token: token + index, + token }) } diff --git a/src/cargo/ops/resolve.rs b/src/cargo/ops/resolve.rs index 8a49de85d..a4c754c3f 100644 --- a/src/cargo/ops/resolve.rs +++ b/src/cargo/ops/resolve.rs @@ -234,7 +234,7 @@ pub fn resolve_with_previous<'a>(registry: &mut PackageRegistry, // for any other packages specified with `-p`. Method::Required { dev_deps, .. } => { let base = Method::Required { - dev_deps: dev_deps, + dev_deps, features: &[], uses_default_features: true, }; diff --git a/src/cargo/sources/config.rs b/src/cargo/sources/config.rs index 98361ddf0..5db68efd5 100644 --- a/src/cargo/sources/config.rs +++ b/src/cargo/sources/config.rs @@ -56,7 +56,7 @@ impl<'cfg> SourceConfigMap<'cfg> { let mut base = SourceConfigMap { cfgs: HashMap::new(), id2name: HashMap::new(), - config: config, + config, }; base.add("crates-io", SourceConfig { id: SourceId::crates_io(config)?, @@ -208,7 +208,7 @@ restore the source replacement configuration to continue the build self.add(name, SourceConfig { id: src, - replace_with: replace_with, + replace_with, }); return Ok(()); diff --git a/src/cargo/sources/directory.rs b/src/cargo/sources/directory.rs index 04df0a5ba..97cf4242d 100644 --- a/src/cargo/sources/directory.rs +++ b/src/cargo/sources/directory.rs @@ -33,7 +33,7 @@ impl<'cfg> DirectorySource<'cfg> { DirectorySource { source_id: id.clone(), root: path.to_path_buf(), - config: config, + config, packages: HashMap::new(), } } diff --git a/src/cargo/sources/git/source.rs b/src/cargo/sources/git/source.rs index 0ec9c1697..6d3d878a6 100644 --- a/src/cargo/sources/git/source.rs +++ b/src/cargo/sources/git/source.rs @@ -37,13 +37,13 @@ impl<'cfg> GitSource<'cfg> { }; let source = GitSource { - remote: remote, - reference: reference, + remote, + reference, source_id: source_id.clone(), path_source: None, rev: None, - ident: ident, - config: config, + ident, + config, }; Ok(source) diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index 6fe8fad74..f7ae61619 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -109,7 +109,7 @@ impl GitRemote { Ok(GitDatabase { remote: self.clone(), path: into.to_path_buf(), - repo: repo, + repo, }) } @@ -118,7 +118,7 @@ impl GitRemote { Ok(GitDatabase { remote: self.clone(), path: db_path.to_path_buf(), - repo: repo, + repo, }) } @@ -210,9 +210,9 @@ impl<'a> GitCheckout<'a> { { GitCheckout { location: path.to_path_buf(), - database: database, - revision: revision, - repo: repo, + database, + revision, + repo, } } diff --git a/src/cargo/sources/path.rs b/src/cargo/sources/path.rs index 9148ccb0f..87a156c99 100644 --- a/src/cargo/sources/path.rs +++ b/src/cargo/sources/path.rs @@ -34,7 +34,7 @@ impl<'cfg> PathSource<'cfg> { path: path.to_path_buf(), updated: false, packages: Vec::new(), - config: config, + config, recursive: false, } } diff --git a/src/cargo/sources/registry/index.rs b/src/cargo/sources/registry/index.rs index 710c8ac89..d3135bac3 100644 --- a/src/cargo/sources/registry/index.rs +++ b/src/cargo/sources/registry/index.rs @@ -31,8 +31,8 @@ impl<'cfg> RegistryIndex<'cfg> { path: path.clone(), cache: HashMap::new(), hashes: HashMap::new(), - config: config, - locked: locked, + config, + locked, } } diff --git a/src/cargo/sources/registry/local.rs b/src/cargo/sources/registry/local.rs index d4d67a229..73f6f719b 100644 --- a/src/cargo/sources/registry/local.rs +++ b/src/cargo/sources/registry/local.rs @@ -25,7 +25,7 @@ impl<'cfg> LocalRegistry<'cfg> { src_path: config.registry_source_path().join(name), index_path: Filesystem::new(root.join("index")), root: Filesystem::new(root.to_path_buf()), - config: config, + config, } } } diff --git a/src/cargo/sources/registry/mod.rs b/src/cargo/sources/registry/mod.rs index e7edf91f1..93ff9a866 100644 --- a/src/cargo/sources/registry/mod.rs +++ b/src/cargo/sources/registry/mod.rs @@ -288,15 +288,15 @@ impl<'cfg> RegistrySource<'cfg> { index_locked: bool) -> RegistrySource<'cfg> { RegistrySource { src_path: config.registry_source_path().join(name), - config: config, + config, source_id: source_id.clone(), updated: false, index: index::RegistryIndex::new(source_id, ops.index_path(), config, index_locked), - index_locked: index_locked, - ops: ops, + index_locked, + ops, } } diff --git a/src/cargo/sources/registry/remote.rs b/src/cargo/sources/registry/remote.rs index 331183e6d..47f940f92 100644 --- a/src/cargo/sources/registry/remote.rs +++ b/src/cargo/sources/registry/remote.rs @@ -36,7 +36,7 @@ impl<'cfg> RemoteRegistry<'cfg> { index_path: config.registry_index_path().join(name), cache_path: config.registry_cache_path().join(name), source_id: source_id.clone(), - config: config, + config, tree: RefCell::new(None), repo: LazyCell::new(), head: Cell::new(None), diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index 8d1d75e86..588ad3592 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -84,7 +84,7 @@ impl Config { home_path: Filesystem::new(homedir), shell: RefCell::new(shell), rustc: LazyCell::new(), - cwd: cwd, + cwd, values: LazyCell::new(), cargo_exe: LazyCell::new(), rustdoc: LazyCell::new(), diff --git a/src/cargo/util/errors.rs b/src/cargo/util/errors.rs index 565b41bb4..e552069d0 100644 --- a/src/cargo/util/errors.rs +++ b/src/cargo/util/errors.rs @@ -104,8 +104,8 @@ impl CargoTestError { .collect::>() .join("\n"); CargoTestError { - test: test, - desc: desc, + test, + desc, exit: errors[0].exit, causes: errors, } @@ -201,7 +201,7 @@ pub fn process_error(msg: &str, } return ProcessError { - desc: desc, + desc, exit: status.cloned(), output: output.cloned(), }; diff --git a/src/cargo/util/flock.rs b/src/cargo/util/flock.rs index 2913d4363..28e720637 100644 --- a/src/cargo/util/flock.rs +++ b/src/cargo/util/flock.rs @@ -17,7 +17,7 @@ pub struct FileLock { state: State, } -#[derive(PartialEq)] +#[derive(PartialEq, Debug)] enum State { Unlocked, Shared, @@ -35,13 +35,13 @@ impl FileLock { /// Note that special care must be taken to ensure that the path is not /// referenced outside the lifetime of this lock. pub fn path(&self) -> &Path { - assert!(self.state != State::Unlocked); + assert_ne!(self.state, State::Unlocked); &self.path } /// Returns the parent path containing this file pub fn parent(&self) -> &Path { - assert!(self.state != State::Unlocked); + assert_ne!(self.state, State::Unlocked); self.path.parent().unwrap() } @@ -229,7 +229,7 @@ impl Filesystem { State::Unlocked => {} } - Ok(FileLock { f: Some(f), path: path, state: state }) + Ok(FileLock { f: Some(f), path, state }) } } diff --git a/src/cargo/util/job.rs b/src/cargo/util/job.rs index 42035e171..be072a3eb 100644 --- a/src/cargo/util/job.rs +++ b/src/cargo/util/job.rs @@ -114,7 +114,7 @@ mod imp { return None } - Some(Setup { job: job }) + Some(Setup { job }) } impl Drop for Setup { diff --git a/src/cargo/util/process_builder.rs b/src/cargo/util/process_builder.rs index 8082369d9..6a8ceff9c 100644 --- a/src/cargo/util/process_builder.rs +++ b/src/cargo/util/process_builder.rs @@ -244,9 +244,9 @@ impl ProcessBuilder { None) })?; let output = Output { - stdout: stdout, - stderr: stderr, - status: status, + stdout, + stderr, + status, }; { diff --git a/src/cargo/util/read2.rs b/src/cargo/util/read2.rs index 7b2681082..ba8b2b58d 100644 --- a/src/cargo/util/read2.rs +++ b/src/cargo/util/read2.rs @@ -137,7 +137,7 @@ mod imp { impl<'a> Pipe<'a> { unsafe fn new(p: P, dst: &'a mut Vec) -> Pipe<'a> { Pipe { - dst: dst, + dst, pipe: NamedPipe::from_raw_handle(p.into_raw_handle()), overlapped: Overlapped::zero(), done: false, diff --git a/src/cargo/util/rustc.rs b/src/cargo/util/rustc.rs index a9b65c959..fdd96748c 100644 --- a/src/cargo/util/rustc.rs +++ b/src/cargo/util/rustc.rs @@ -40,10 +40,10 @@ impl Rustc { }; Ok(Rustc { - path: path, - wrapper: wrapper, - verbose_version: verbose_version, - host: host, + path, + wrapper, + verbose_version, + host, }) } diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 7fc975a0a..3e1878853 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -301,22 +301,22 @@ impl<'de> de::Deserialize<'de> for U32OrBool { formatter.write_str("a boolean or an integer") } - fn visit_i64(self, u: i64) -> Result + fn visit_bool(self, b: bool) -> Result where E: de::Error, { - Ok(U32OrBool::U32(u as u32)) + Ok(U32OrBool::Bool(b)) } - fn visit_u64(self, u: u64) -> Result + fn visit_i64(self, u: i64) -> Result where E: de::Error, { Ok(U32OrBool::U32(u as u32)) } - fn visit_bool(self, b: bool) -> Result + fn visit_u64(self, u: u64) -> Result where E: de::Error, { - Ok(U32OrBool::Bool(b)) + Ok(U32OrBool::U32(u as u32)) } } @@ -361,16 +361,16 @@ impl<'de> de::Deserialize<'de> for StringOrBool { formatter.write_str("a boolean or a string") } - fn visit_str(self, s: &str) -> Result + fn visit_bool(self, b: bool) -> Result where E: de::Error, { - Ok(StringOrBool::String(s.to_string())) + Ok(StringOrBool::Bool(b)) } - fn visit_bool(self, b: bool) -> Result + fn visit_str(self, s: &str) -> Result where E: de::Error, { - Ok(StringOrBool::Bool(b)) + Ok(StringOrBool::String(s.to_string())) } } @@ -604,9 +604,9 @@ impl TomlManifest { let mut cx = Context { pkgid: Some(&pkgid), deps: &mut deps, - source_id: source_id, + source_id, nested_paths: &mut nested_paths, - config: config, + config, warnings: &mut warnings, features: &features, platform: None, @@ -800,13 +800,13 @@ impl TomlManifest { let mut cx = Context { pkgid: None, deps: &mut deps, - source_id: source_id, + source_id, nested_paths: &mut nested_paths, - config: config, + config, warnings: &mut warnings, platform: None, features: &features, - root: root + root }; (me.replace(&mut cx)?, me.patch(&mut cx)?) }; @@ -1207,7 +1207,7 @@ fn build_profiles(profiles: &Option) -> Profiles { Some(StringOrBool::String(ref n)) => Lto::Named(n.clone()), None => profile.lto, }, - codegen_units: codegen_units, + codegen_units, rustc_args: None, rustdoc_args: None, debuginfo: debug.unwrap_or(profile.debuginfo), diff --git a/src/crates-io/lib.rs b/src/crates-io/lib.rs index 19d3e700c..637fa4303 100644 --- a/src/crates-io/lib.rs +++ b/src/crates-io/lib.rs @@ -103,9 +103,9 @@ impl Registry { token: Option, handle: Easy) -> Registry { Registry { - host: host, - token: token, - handle: handle, + host, + token, + handle, } } @@ -197,8 +197,8 @@ impl Registry { .unwrap_or_else(Vec::new); Ok(Warnings { - invalid_categories: invalid_categories, - invalid_badges: invalid_badges, + invalid_categories, + invalid_badges, }) } diff --git a/tests/testsuite/cargotest/support/git.rs b/tests/testsuite/cargotest/support/git.rs index 439457c23..0fe2db676 100644 --- a/tests/testsuite/cargotest/support/git.rs +++ b/tests/testsuite/cargotest/support/git.rs @@ -27,7 +27,7 @@ impl RepoBuilder { t!(config.set_str("user.name", "name")); t!(config.set_str("user.email", "email")); } - RepoBuilder { repo: repo, files: Vec::new() } + RepoBuilder { repo, files: Vec::new() } } pub fn file(self, path: &str, contents: &str) -> RepoBuilder { diff --git a/tests/testsuite/cargotest/support/mod.rs b/tests/testsuite/cargotest/support/mod.rs index 099e39d18..07e5f6f3c 100644 --- a/tests/testsuite/cargotest/support/mod.rs +++ b/tests/testsuite/cargotest/support/mod.rs @@ -45,7 +45,7 @@ struct FileBuilder { impl FileBuilder { pub fn new(path: PathBuf, body: &str) -> FileBuilder { - FileBuilder { path: path, body: body.to_string() } + FileBuilder { path, body: body.to_string() } } fn mk(&self) { @@ -71,7 +71,7 @@ struct SymlinkBuilder { impl SymlinkBuilder { pub fn new(dst: PathBuf, src: PathBuf) -> SymlinkBuilder { - SymlinkBuilder { dst: dst, src: src } + SymlinkBuilder { dst, src } } #[cfg(unix)] @@ -699,7 +699,7 @@ fn find_mismatch<'a>(expected: &'a Value, actual: &'a Value) assert!(r.len() > 0); Some((&l[0], &r[0])) } else { - assert!(r.len() == 0); + assert_eq!(r.len(), 0); None } } diff --git a/tests/testsuite/cargotest/support/paths.rs b/tests/testsuite/cargotest/support/paths.rs index 8a74fc0f6..3358036ef 100644 --- a/tests/testsuite/cargotest/support/paths.rs +++ b/tests/testsuite/cargotest/support/paths.rs @@ -67,7 +67,7 @@ pub trait CargoPathExt { self.move_in_time(|sec, nsec| (sec + 3600, nsec)) } - fn move_in_time(&self, F) + fn move_in_time(&self, travel_amount: F) where F: Fn(u64, u32) -> (u64, u32); } diff --git a/tests/testsuite/directory.rs b/tests/testsuite/directory.rs index 47a6173e4..6327b7b2c 100644 --- a/tests/testsuite/directory.rs +++ b/tests/testsuite/directory.rs @@ -602,7 +602,7 @@ fn git_lock_file_doesnt_change() { let mut lock2 = String::new(); t!(t!(File::open(p.root().join("Cargo.lock"))).read_to_string(&mut lock2)); - assert!(lock1 == lock2, "lock files changed"); + assert_eq!(lock1, lock2, "lock files changed"); } #[test] diff --git a/tests/testsuite/generate_lockfile.rs b/tests/testsuite/generate_lockfile.rs index 30b2651bc..efd0c6124 100644 --- a/tests/testsuite/generate_lockfile.rs +++ b/tests/testsuite/generate_lockfile.rs @@ -42,7 +42,7 @@ fn adding_and_removing_packages() { assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); let lock2 = p.read_lockfile(); - assert!(lock1 != lock2); + assert_ne!(lock1, lock2); // change the dep File::create(&p.root().join("bar/Cargo.toml")).unwrap().write_all(br#" @@ -54,8 +54,8 @@ fn adding_and_removing_packages() { assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); let lock3 = p.read_lockfile(); - assert!(lock1 != lock3); - assert!(lock2 != lock3); + assert_ne!(lock1, lock3); + assert_ne!(lock2, lock3); // remove the dep println!("lock4"); diff --git a/tests/testsuite/install.rs b/tests/testsuite/install.rs index c3da7daa0..edb1dc627 100644 --- a/tests/testsuite/install.rs +++ b/tests/testsuite/install.rs @@ -901,7 +901,7 @@ fn use_path_workspace() { let lock = p.read_lockfile(); assert_that(p.cargo("install"), execs().with_status(0)); let lock2 = p.read_lockfile(); - assert!(lock == lock2, "different lockfiles"); + assert_eq!(lock, lock2, "different lockfiles"); } #[test] diff --git a/tests/testsuite/patch.rs b/tests/testsuite/patch.rs index 47ca00320..8a0d754d9 100644 --- a/tests/testsuite/patch.rs +++ b/tests/testsuite/patch.rs @@ -681,7 +681,7 @@ fn remove_patch() { assert!(lock_file1.contains("bar")); assert_eq!(lock_file2, lock_file3); - assert!(lock_file1 != lock_file2); + assert_ne!(lock_file1, lock_file2); } #[test] -- 2.30.2