Skip to content

Commit

Permalink
Auto merge of #6407 - sinkuu:redundant_clone, r=dwijnand
Browse files Browse the repository at this point in the history
Remove redundant clones
  • Loading branch information
bors committed Dec 9, 2018
2 parents a6b2148 + 35a2b86 commit 28fb200
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/build_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl BuildConfig {
}
}
let cfg_target = config.get_string("build.target")?.map(|s| s.val);
let target = requested_target.clone().or(cfg_target);
let target = requested_target.or(cfg_target);

if jobs == Some(0) {
bail!("jobs must be at least 1")
Expand Down
6 changes: 3 additions & 3 deletions src/cargo/core/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ fn lock(locked: &LockedMap, patches: &HashMap<Url, Vec<PackageId>>, summary: Sum
let locked = locked_deps.iter().find(|&&id| dep.matches_id(id));
if let Some(&locked) = locked {
trace!("\tfirst hit on {}", locked);
let mut dep = dep.clone();
let mut dep = dep;
dep.lock_to(locked);
return dep;
}
Expand All @@ -609,7 +609,7 @@ fn lock(locked: &LockedMap, patches: &HashMap<Url, Vec<PackageId>>, summary: Sum
.and_then(|vec| vec.iter().find(|&&(id, _)| dep.matches_id(id)));
if let Some(&(id, _)) = v {
trace!("\tsecond hit on {}", id);
let mut dep = dep.clone();
let mut dep = dep;
dep.lock_to(id);
return dep;
}
Expand All @@ -635,7 +635,7 @@ fn lock(locked: &LockedMap, patches: &HashMap<Url, Vec<PackageId>>, summary: Sum
if patch_locked {
trace!("\tthird hit on {}", patch_id);
let req = VersionReq::exact(patch_id.version());
let mut dep = dep.clone();
let mut dep = dep;
dep.set_version_req(req);
return dep;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/resolver/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ unable to verify that `{0}` is the same as when the lockfile was generated
to
);
}
Ok(name.to_string())
Ok(name)
}

fn dependencies_listed(&self, from: PackageId, to: PackageId) -> &[Dependency] {
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn run(
let exe = &compile.binaries[0];
let exe = match util::without_prefix(exe, config.cwd()) {
Some(path) if path.file_name() == Some(path.as_os_str()) => {
Path::new(".").join(path).to_path_buf()
Path::new(".").join(path)
}
Some(path) => path.to_path_buf(),
None => exe.to_path_buf(),
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/sources/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ impl<'cfg> RegistrySource<'cfg> {
.chain_err(|| format!("failed to unpack entry at `{}`", entry_path.display()))?;
}
File::create(&ok)?;
Ok(dst.clone())
Ok(dst)
}

fn do_update(&mut self) -> CargoResult<()> {
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/sources/registry/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl<'cfg> RegistryData for RemoteRegistry<'cfg> {
}

let config = self.config()?.unwrap();
let mut url = config.dl.clone();
let mut url = config.dl;
if !url.contains(CRATE_TEMPLATE) && !url.contains(VERSION_TEMPLATE) {
write!(url, "/{}/{}/download", CRATE_TEMPLATE, VERSION_TEMPLATE).unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/util/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ impl ConfigSeqAccess {
if !(v.starts_with('[') && v.ends_with(']')) {
return Err(ConfigError::new(
format!("should have TOML list syntax, found `{}`", v),
def.clone(),
def,
));
}
let temp_key = key.last().to_env();
Expand Down

0 comments on commit 28fb200

Please sign in to comment.