diff --git a/src/bin/cargo/commands/vendor.rs b/src/bin/cargo/commands/vendor.rs
index 509a5c2b2b1..da0e5838562 100644
--- a/src/bin/cargo/commands/vendor.rs
+++ b/src/bin/cargo/commands/vendor.rs
@@ -93,20 +93,24 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
         None
     };
     if let Some(flag) = crates_io_cargo_vendor_flag {
-        return Err(failure::format_err!("\
+        return Err(failure::format_err!(
+            "\
 the crates.io `cargo vendor` command has now been merged into Cargo itself
 and does not support the flag `{}` currently; to continue using the flag you
 can execute `cargo-vendor vendor ...`, and if you would like to see this flag
 supported in Cargo itself please feel free to file an issue at
 https://github.com/rust-lang/cargo/issues/new
-", flag).into());
+",
+            flag
+        )
+        .into());
     }
 
     let ws = args.workspace(config)?;
     let path = args
         .value_of_os("path")
         .map(|val| PathBuf::from(val.to_os_string()))
-        .unwrap_or(PathBuf::from("vendor"));
+        .unwrap_or_else(|| PathBuf::from("vendor"));
     ops::vendor(
         &ws,
         &ops::VendorOptions {
diff --git a/src/cargo/core/compiler/context/compilation_files.rs b/src/cargo/core/compiler/context/compilation_files.rs
index 954c6601d44..ed3232ea48e 100644
--- a/src/cargo/core/compiler/context/compilation_files.rs
+++ b/src/cargo/core/compiler/context/compilation_files.rs
@@ -559,7 +559,7 @@ fn compute_metadata<'a, 'cfg>(
     } else {
         cx.bcx.rustflags_args(unit)
     }
-    .into_iter();
+    .iter();
 
     // Ignore some flags. These may affect reproducible builds if they affect
     // the path. The fingerprint will handle recompilation if these change.
diff --git a/src/cargo/core/compiler/mod.rs b/src/cargo/core/compiler/mod.rs
index d64e9e69862..ffaf598e88c 100644
--- a/src/cargo/core/compiler/mod.rs
+++ b/src/cargo/core/compiler/mod.rs
@@ -1309,7 +1309,7 @@ fn replay_output_cache(
         }
         let contents = fs::read_to_string(&path)?;
         for line in contents.lines() {
-            on_stderr_line(state, &line, package_id, &target, &mut options)?;
+            on_stderr_line(state, line, package_id, &target, &mut options)?;
         }
         Ok(())
     })
diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs
index b91905d6c95..64e1ea2eae5 100644
--- a/src/cargo/lib.rs
+++ b/src/cargo/lib.rs
@@ -3,7 +3,7 @@
 #![warn(rust_2018_idioms)]
 // Clippy isn't enforced by CI (@alexcrichton isn't a fan).
 #![allow(clippy::blacklisted_name)] // frequently used in tests
-#![allow(clippy::cyclomatic_complexity)] // large project
+#![allow(clippy::cognitive_complexity)] // large project
 #![allow(clippy::derive_hash_xor_eq)] // there's an intentional incoherence
 #![allow(clippy::explicit_into_iter_loop)] // explicit loops are clearer
 #![allow(clippy::explicit_iter_loop)] // explicit loops are clearer
@@ -160,7 +160,6 @@ fn handle_cause(cargo_err: &Error, shell: &mut Shell) -> bool {
 
     // The first error has already been printed to the shell.
     for err in cargo_err.iter_causes() {
-
         // If we're not in verbose mode then print remaining errors until one
         // marked as `Internal` appears.
         if verbose != Verbose && err.downcast_ref::<Internal>().is_some() {
diff --git a/src/cargo/ops/vendor.rs b/src/cargo/ops/vendor.rs
index fccee96997e..39ee0044545 100644
--- a/src/cargo/ops/vendor.rs
+++ b/src/cargo/ops/vendor.rs
@@ -27,7 +27,7 @@ pub fn vendor(ws: &Workspace<'_>, opts: &VendorOptions<'_>) -> CargoResult<()> {
     }
     let workspaces = extra_workspaces.iter().chain(Some(ws)).collect::<Vec<_>>();
     let vendor_config =
-        sync(ws.config(), &workspaces, opts).chain_err(|| format!("failed to sync"))?;
+        sync(ws.config(), &workspaces, opts).chain_err(|| "failed to sync".to_string())?;
 
     let shell = ws.config().shell();
     if shell.verbosity() != Verbosity::Quiet {
@@ -97,7 +97,7 @@ fn sync(
     // crate to work with.
     for ws in workspaces {
         let (packages, resolve) =
-            ops::resolve_ws(&ws).chain_err(|| "failed to load pkg lockfile")?;
+            ops::resolve_ws(ws).chain_err(|| "failed to load pkg lockfile")?;
 
         packages
             .get_many(resolve.iter())
@@ -129,7 +129,7 @@ fn sync(
     // tables about them.
     for ws in workspaces {
         let (packages, resolve) =
-            ops::resolve_ws(&ws).chain_err(|| "failed to load pkg lockfile")?;
+            ops::resolve_ws(ws).chain_err(|| "failed to load pkg lockfile")?;
 
         packages
             .get_many(resolve.iter())
@@ -142,14 +142,14 @@ fn sync(
                 continue;
             }
             ids.insert(
-                pkg.clone(),
+                pkg,
                 packages
                     .get_one(pkg)
                     .chain_err(|| "failed to fetch package")?
                     .clone(),
             );
 
-            checksums.insert(pkg.clone(), resolve.checksums().get(&pkg).cloned());
+            checksums.insert(pkg, resolve.checksums().get(&pkg).cloned());
         }
     }
 
@@ -204,10 +204,10 @@ fn sync(
         )?;
 
         let _ = fs::remove_dir_all(&dst);
-        let pathsource = PathSource::new(&src, id.source_id(), config);
-        let paths = pathsource.list_files(&pkg)?;
+        let pathsource = PathSource::new(src, id.source_id(), config);
+        let paths = pathsource.list_files(pkg)?;
         let mut map = BTreeMap::new();
-        cp_sources(&src, &paths, &dst, &mut map)
+        cp_sources(src, &paths, &dst, &mut map)
             .chain_err(|| format!("failed to copy over vendored sources for: {}", id))?;
 
         // Finally, emit the metadata about this package
diff --git a/src/cargo/util/sha256.rs b/src/cargo/util/sha256.rs
index a8f762c15e0..b2cd8cab08a 100644
--- a/src/cargo/util/sha256.rs
+++ b/src/cargo/util/sha256.rs
@@ -1,9 +1,9 @@
 use self::crypto_hash::{Algorithm, Hasher};
-use std::fs::File;
+use crate::util::{CargoResult, CargoResultExt};
 use crypto_hash;
-use std::io::{self, Write, Read};
+use std::fs::File;
+use std::io::{self, Read, Write};
 use std::path::Path;
-use crate::util::{CargoResult, CargoResultExt};
 
 pub struct Sha256(Hasher);
 
diff --git a/tests/testsuite/resolve.rs b/tests/testsuite/resolve.rs
index d2876b3f34a..6bc996258b3 100644
--- a/tests/testsuite/resolve.rs
+++ b/tests/testsuite/resolve.rs
@@ -246,7 +246,7 @@ fn pub_fail() {
         pkg!(("e", "0.0.6") => [dep_req_kind("a", "<= 0.0.4", Kind::Normal, true),]),
         pkg!(("kB", "0.0.3") => [dep_req("a", ">= 0.0.5"),dep("e"),]),
     ];
-    let reg = registry(input.clone());
+    let reg = registry(input);
     assert!(resolve_and_validated(pkg_id("root"), vec![dep("kB")], &reg, None).is_err());
 }
 
diff --git a/tests/testsuite/support/resolver.rs b/tests/testsuite/support/resolver.rs
index eddd5ba9d72..31b349fcbcd 100644
--- a/tests/testsuite/support/resolver.rs
+++ b/tests/testsuite/support/resolver.rs
@@ -428,7 +428,7 @@ impl SatResolve {
                 .unwrap_or(&empty_vec)
                 .iter()
                 .filter(|&p| dep.matches_id(*p))
-                .map(|p| self.var_for_is_packages_used[&p].positive())
+                .map(|p| self.var_for_is_packages_used[p].positive())
                 .collect();
             if matches.is_empty() {
                 return false;