Reset unneeded lint changes
authorLukas Lueg <lukas.lueg@gmail.com>
Tue, 26 Sep 2017 07:54:07 +0000 (09:54 +0200)
committerLukas Lueg <lukas.lueg@gmail.com>
Tue, 26 Sep 2017 08:04:16 +0000 (10:04 +0200)
src/cargo/core/registry.rs
src/cargo/core/resolver/mod.rs
src/cargo/core/workspace.rs
src/cargo/ops/cargo_generate_lockfile.rs
src/cargo/ops/cargo_new.rs
src/cargo/ops/cargo_read_manifest.rs
src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/cargo_rustc/custom_build.rs
src/cargo/ops/cargo_rustc/fingerprint.rs
src/cargo/ops/cargo_rustc/mod.rs
src/cargo/sources/path.rs

index 7052ba509ff956e69d69facfdbfdefe2ab6881ef..517486801d2107e4f66193c30794bcad7051b799 100644 (file)
@@ -309,6 +309,7 @@ http://doc.crates.io/specifying-dependencies.html#overriding-dependencies
                 dependencies; the dependency on `{}` was removed\n\n
                 {}", override_summary.package_id().name(), id.name(), boilerplate);
             self.source_config.config().shell().warn(&msg)?;
+            return Ok(())
         }
 
         Ok(())
index 573a6be1c914845d6d6fb866a6672a3423005592..b605742d4ed7b35c45e8b9bc50830d69a0548874 100644 (file)
@@ -478,7 +478,7 @@ impl<T> RcVecIter<T> {
 impl<T> Clone for RcVecIter<T> {
     fn clone(&self) -> RcVecIter<T> {
         RcVecIter {
-            vec: Rc::clone(&self.vec),
+            vec: self.vec.clone(),
             rest: self.rest.clone(),
         }
     }
index 48d379343c9883e706e004558fa36c89271f9812..9c012bf221ad34de204026f4caa2ae42758f6b2d 100644 (file)
@@ -392,10 +392,13 @@ impl<'cfg> Workspace<'cfg> {
         }
 
         let root = root_manifest.parent().unwrap();
-        if let WorkspaceConfig::Root { ref members, ref exclude } = *self.packages.load(root_manifest)?.workspace_config() {
-            if is_excluded(members, exclude, root, &manifest_path) {
-                return Ok(())
+        match *self.packages.load(root_manifest)?.workspace_config() {
+            WorkspaceConfig::Root { ref members, ref exclude } => {
+                if is_excluded(members, exclude, root, &manifest_path) {
+                    return Ok(())
+                }
             }
+            _ => {}
         }
 
         debug!("find_members - {}", manifest_path.display());
index 7be8ae05ae5cc78fdc4eb5992ce4aa88ab5f2e3f..d07ee9672056f9be64c644fad8ff9fafd62a4d90 100644 (file)
@@ -162,10 +162,10 @@ pub fn update_lockfile(ws: &Workspace, opts: &UpdateOptions)
         let mut changes = BTreeMap::new();
         let empty = (Vec::new(), Vec::new());
         for dep in previous_resolve.iter() {
-            changes.entry(key(dep)).or_insert_with(|| empty.clone()).0.push(dep);
+            changes.entry(key(dep)).or_insert(empty.clone()).0.push(dep);
         }
         for dep in resolve.iter() {
-            changes.entry(key(dep)).or_insert_with(|| empty.clone()).1.push(dep);
+            changes.entry(key(dep)).or_insert(empty.clone()).1.push(dep);
         }
 
         for v in changes.values_mut() {
index b7b30f7e27ae5dc6f26b4f249d848290b803d4ed..9c597df85112dd937a3023383f022d11d61c11a9 100644 (file)
@@ -175,12 +175,12 @@ fn detect_source_paths_and_types(project_path : &Path,
     }
 
     let tests = vec![
-        Test { proposed_path: String::from("src/main.rs"), handling: H::Bin },
-        Test { proposed_path: String::from("main.rs"), handling: H::Bin },
+        Test { proposed_path: format!("src/main.rs"),     handling: H::Bin },
+        Test { proposed_path: format!("main.rs"),         handling: H::Bin },
         Test { proposed_path: format!("src/{}.rs", name), handling: H::Detect },
-        Test { proposed_path: format!("{}.rs", name), handling: H::Detect },
-        Test { proposed_path: String::from("src/lib.rs"), handling: H::Lib },
-        Test { proposed_path: String::from("lib.rs"), handling: H::Lib },
+        Test { proposed_path: format!("{}.rs", name),     handling: H::Detect },
+        Test { proposed_path: format!("src/lib.rs"),      handling: H::Lib },
+        Test { proposed_path: format!("lib.rs"),          handling: H::Lib },
     ];
 
     for i in tests {
@@ -406,7 +406,8 @@ fn mk(config: &Config, opts: &MkOptions) -> CargoResult<()> {
     let in_existing_vcs_repo = existing_vcs_repo(path.parent().unwrap_or(path), config.cwd());
     let vcs = match (opts.version_control, cfg.version_control, in_existing_vcs_repo) {
         (None, None, false) => VersionControl::Git,
-        (None, Some(option), false) | (Some(option), _, _) => option,
+        (None, Some(option), false) => option,
+        (Some(option), _, _) => option,
         (_, _, true) => VersionControl::NoVcs,
     };
     match vcs {
index dc8b747868489b90f46581c07861172ef9ef9470..19d9f6aef49e77ec470945978a8de466b1427683 100644 (file)
@@ -1,5 +1,4 @@
 use std::collections::{HashMap, HashSet};
-use std::collections::hash_map::Entry;
 use std::fs;
 use std::io;
 use std::path::{Path, PathBuf};
@@ -138,10 +137,12 @@ fn read_nested_packages(path: &Path,
     };
     let pkg = Package::new(manifest, &manifest_path);
 
-    match all_packages.entry(pkg.package_id().clone()) {
-        Entry::Occupied(_) => { info!("skipping nested package `{}` found at `{}`",
-                         pkg.name(), path.to_string_lossy()); },
-        Entry::Vacant(e) => { e.insert(pkg); }
+    let pkg_id = pkg.package_id().clone();
+    if !all_packages.contains_key(&pkg_id) {
+        all_packages.insert(pkg_id, pkg);
+    } else {
+        info!("skipping nested package `{}` found at `{}`",
+              pkg.name(), path.to_string_lossy());
     }
 
     // Registry sources are not allowed to have `path=` dependencies because
index 219d16846ee28443872c3eebea03955ed8c4dd74..219496af894949397854647d42c34b4c9b5ee751 100755 (executable)
@@ -429,7 +429,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
 
     /// Return the target triple which this context is targeting.
     pub fn target_triple(&self) -> &str {
-        self.requested_target().unwrap_or_else(|| self.host_triple())
+        self.requested_target().unwrap_or(self.host_triple())
     }
 
     /// Requested (not actual) target for the build
index fee750c4cb5c5b8ffbf24958aa17d9ded2f06da4..ad117880090c6061981fe6da5ec29bf063f1173b 100644 (file)
@@ -143,9 +143,9 @@ fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>)
         match *cfg {
             Cfg::Name(ref n) => { cfg_map.insert(n.clone(), None); }
             Cfg::KeyPair(ref k, ref v) => {
-                if let Some(ref mut values) = *cfg_map.entry(k.clone())
-                                                      .or_insert_with(|| Some(Vec::new())) {
-                    values.push(v.clone())
+                match *cfg_map.entry(k.clone()).or_insert(Some(Vec::new())) {
+                    Some(ref mut values) => values.push(v.clone()),
+                    None => { /* ... */ }
                 }
             }
         }
index fdd37f05f1cc2fd2851e3bc48f7ae263871ba669..f78274ac57d5d83181bf43970d9e91f27aceb1d1 100644 (file)
@@ -287,8 +287,16 @@ impl Fingerprint {
 
 impl hash::Hash for Fingerprint {
     fn hash<H: Hasher>(&self, h: &mut H) {
-        let Fingerprint { rustc, ref features, target, profile, ref deps,
-                          ref local, ref rustflags, .. } = *self;
+        let Fingerprint {
+            rustc,
+            ref features,
+            target,
+            profile,
+            ref deps,
+            ref local,
+            memoized_hash: _,
+            ref rustflags,
+        } = *self;
         (rustc, features, target, profile, local, rustflags).hash(h);
 
         h.write_usize(deps.len());
index 6a12a215ccbf630ecc04c0fc369cabbd1910d5cd..3e7fdbd2fa526f475abea94911d01f4d6993a26e 100644 (file)
@@ -295,7 +295,7 @@ fn rustc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>,
     let kind = unit.kind;
 
     // Prepare the native lib state (extra -L and -l flags)
-    let build_state = Arc::clone(&cx.build_state);
+    let build_state = cx.build_state.clone();
     let current_id = unit.pkg.package_id().clone();
     let build_deps = load_build_deps(cx, unit);
 
@@ -323,7 +323,7 @@ fn rustc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>,
     let target = unit.target.clone();
 
     exec.init(cx, unit);
-    let exec = Arc::clone(&exec);
+    let exec = exec.clone();
 
     let root_output = cx.target_root().to_path_buf();
 
@@ -645,7 +645,7 @@ fn rustdoc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>,
     rustdoc.args(&cx.rustdocflags_args(unit)?);
 
     let name = unit.pkg.name().to_string();
-    let build_state = Arc::clone(&cx.build_state);
+    let build_state = cx.build_state.clone();
     let key = (unit.pkg.package_id().clone(), unit.kind);
 
     Ok(Work::new(move |state| {
@@ -690,7 +690,7 @@ fn build_base_args<'a, 'cfg>(cx: &mut Context<'a, 'cfg>,
     let Profile {
         ref opt_level, lto, codegen_units, ref rustc_args, debuginfo,
         debug_assertions, overflow_checks, rpath, test, doc: _doc,
-        run_custom_build, ref panic, check, ..
+        run_custom_build, ref panic, rustdoc_args: _, check,
     } = *unit.profile;
     assert!(!run_custom_build);
 
index 980d311fac74baf8f17307dc1c2b1755642d10c5..11760c29a63ef332e6322d77e23ed56c126f82b0 100644 (file)
@@ -217,14 +217,14 @@ impl<'cfg> PathSource<'cfg> {
                             ))?;
                     }
                 } else if no_include_option {
-                        self.config
-                            .shell()
-                            .warn(format!(
-                                "Pattern matching for Cargo's include/exclude fields is changing and \
-                                file `{}` WILL NOT be excluded in a future Cargo version.\n\
-                                See https://github.com/rust-lang/cargo/issues/4268 for more info",
-                                relative_path.display()
-                            ))?;
+                    self.config
+                        .shell()
+                        .warn(format!(
+                            "Pattern matching for Cargo's include/exclude fields is changing and \
+                            file `{}` WILL NOT be excluded in a future Cargo version.\n\
+                            See https://github.com/rust-lang/cargo/issues/4268 for more info",
+                            relative_path.display()
+                        ))?;
                 } else {
                     self.config
                         .shell()
@@ -451,9 +451,8 @@ impl<'cfg> PathSource<'cfg> {
             let name = path.file_name().and_then(|s| s.to_str());
             // Skip dotfile directories
             if name.map(|s| s.starts_with('.')) == Some(true) {
-                continue;
-            }
-            if is_root {
+                continue
+            } else if is_root {
                 // Skip cargo artifacts
                 match name {
                     Some("target") | Some("Cargo.lock") => continue,
@@ -532,7 +531,7 @@ impl<'cfg> Source for PathSource<'cfg> {
             // as 0.
             let mtime = fs::metadata(&file).map(|meta| {
                 FileTime::from_last_modification_time(&meta)
-            }).unwrap_or_else(|_| FileTime::zero());
+            }).unwrap_or(FileTime::zero());
             warn!("{} {}", mtime, file.display());
             if mtime > max {
                 max = mtime;