mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Resolve 2 needless_pass_by_value lint warnings
TIL Rust doesn't have equational reasoning.. :-/ (can't inline the new "exec" bindings)
This commit is contained in:
parent
9c3f808c7d
commit
689f412c2f
@ -35,7 +35,7 @@ impl Summary {
|
||||
pub fn new<K>(
|
||||
pkg_id: PackageId,
|
||||
dependencies: Vec<Dependency>,
|
||||
features: BTreeMap<K, Vec<impl AsRef<str>>>,
|
||||
features: &BTreeMap<K, Vec<impl AsRef<str>>>,
|
||||
links: Option<impl AsRef<str>>,
|
||||
namespaced_features: bool,
|
||||
) -> CargoResult<Summary>
|
||||
|
@ -185,7 +185,8 @@ pub fn compile<'a>(
|
||||
ws: &Workspace<'a>,
|
||||
options: &CompileOptions<'a>,
|
||||
) -> CargoResult<Compilation<'a>> {
|
||||
compile_with_exec(ws, options, Arc::new(DefaultExecutor))
|
||||
let exec: Arc<Executor> = Arc::new(DefaultExecutor);
|
||||
compile_with_exec(ws, options, &exec)
|
||||
}
|
||||
|
||||
/// Like `compile` but allows specifying a custom `Executor` that will be able to intercept build
|
||||
@ -193,7 +194,7 @@ pub fn compile<'a>(
|
||||
pub fn compile_with_exec<'a>(
|
||||
ws: &Workspace<'a>,
|
||||
options: &CompileOptions<'a>,
|
||||
exec: Arc<Executor>,
|
||||
exec: &Arc<Executor>,
|
||||
) -> CargoResult<Compilation<'a>> {
|
||||
ws.emit_warnings()?;
|
||||
compile_ws(ws, None, options, exec)
|
||||
@ -203,7 +204,7 @@ pub fn compile_ws<'a>(
|
||||
ws: &Workspace<'a>,
|
||||
source: Option<Box<Source + 'a>>,
|
||||
options: &CompileOptions<'a>,
|
||||
exec: Arc<Executor>,
|
||||
exec: &Arc<Executor>,
|
||||
) -> CargoResult<Compilation<'a>> {
|
||||
let CompileOptions {
|
||||
config,
|
||||
|
@ -12,7 +12,7 @@ use toml;
|
||||
|
||||
use core::{Dependency, Edition, Package, PackageIdSpec, Source, SourceId};
|
||||
use core::{PackageId, Workspace};
|
||||
use core::compiler::DefaultExecutor;
|
||||
use core::compiler::{DefaultExecutor, Executor};
|
||||
use ops::{self, CompileFilter};
|
||||
use sources::{GitSource, PathSource, SourceConfigMap};
|
||||
use util::{internal, Config};
|
||||
@ -262,8 +262,9 @@ fn install_one(
|
||||
check_overwrites(&dst, pkg, &opts.filter, &list, force)?;
|
||||
}
|
||||
|
||||
let exec: Arc<Executor> = Arc::new(DefaultExecutor);
|
||||
let compile =
|
||||
ops::compile_ws(&ws, Some(source), opts, Arc::new(DefaultExecutor)).chain_err(|| {
|
||||
ops::compile_ws(&ws, Some(source), opts, &exec).chain_err(|| {
|
||||
if let Some(td) = td_opt.take() {
|
||||
// preserve the temporary directory, so the user can inspect it
|
||||
td.into_path();
|
||||
|
@ -10,7 +10,7 @@ use git2;
|
||||
use tar::{Archive, Builder, EntryType, Header};
|
||||
|
||||
use core::{Package, Source, SourceId, Workspace};
|
||||
use core::compiler::{BuildConfig, CompileMode, DefaultExecutor};
|
||||
use core::compiler::{BuildConfig, CompileMode, DefaultExecutor, Executor};
|
||||
use sources::PathSource;
|
||||
use util::{self, internal, Config, FileLock};
|
||||
use util::paths;
|
||||
@ -333,6 +333,7 @@ fn run_verify(ws: &Workspace, tar: &FileLock, opts: &PackageOpts) -> CargoResult
|
||||
let pkg_fingerprint = src.last_modified_file(&new_pkg)?;
|
||||
let ws = Workspace::ephemeral(new_pkg, config, None, true)?;
|
||||
|
||||
let exec: Arc<Executor> = Arc::new(DefaultExecutor);
|
||||
ops::compile_ws(
|
||||
&ws,
|
||||
None,
|
||||
@ -350,7 +351,7 @@ fn run_verify(ws: &Workspace, tar: &FileLock, opts: &PackageOpts) -> CargoResult
|
||||
target_rustc_args: None,
|
||||
export_dir: None,
|
||||
},
|
||||
Arc::new(DefaultExecutor),
|
||||
&exec,
|
||||
)?;
|
||||
|
||||
// Check that build.rs didn't modify any files in the src directory.
|
||||
|
@ -253,7 +253,7 @@ impl<'cfg> RegistryIndex<'cfg> {
|
||||
.into_iter()
|
||||
.map(|dep| dep.into_dep(&self.source_id))
|
||||
.collect::<CargoResult<Vec<_>>>()?;
|
||||
let summary = Summary::new(pkgid, deps, features, links, false)?;
|
||||
let summary = Summary::new(pkgid, deps, &features, links, false)?;
|
||||
let summary = summary.set_checksum(cksum.clone());
|
||||
self.hashes
|
||||
.entry(name.as_str())
|
||||
|
@ -893,7 +893,7 @@ impl TomlManifest {
|
||||
let summary = Summary::new(
|
||||
pkgid,
|
||||
deps,
|
||||
me.features
|
||||
&me.features
|
||||
.as_ref()
|
||||
.map(|x| {
|
||||
x.iter()
|
||||
|
@ -38,7 +38,7 @@ fn resolve_with_config(
|
||||
}
|
||||
}
|
||||
let mut registry = MyRegistry(registry);
|
||||
let summary = Summary::new(pkg.clone(), deps, BTreeMap::<String, Vec<String>>::new(), None::<String>, false).unwrap();
|
||||
let summary = Summary::new(pkg.clone(), deps, &BTreeMap::<String, Vec<String>>::new(), None::<String>, false).unwrap();
|
||||
let method = Method::Everything;
|
||||
let resolve = resolver::resolve(
|
||||
&[(summary, method)],
|
||||
@ -100,13 +100,13 @@ macro_rules! pkg {
|
||||
let pkgid = $pkgid.to_pkgid();
|
||||
let link = if pkgid.name().ends_with("-sys") {Some(pkgid.name().as_str())} else {None};
|
||||
|
||||
Summary::new(pkgid, d, BTreeMap::<String, Vec<String>>::new(), link, false).unwrap()
|
||||
Summary::new(pkgid, d, &BTreeMap::<String, Vec<String>>::new(), link, false).unwrap()
|
||||
});
|
||||
|
||||
($pkgid:expr) => ({
|
||||
let pkgid = $pkgid.to_pkgid();
|
||||
let link = if pkgid.name().ends_with("-sys") {Some(pkgid.name().as_str())} else {None};
|
||||
Summary::new(pkgid, Vec::new(), BTreeMap::<String, Vec<String>>::new(), link, false).unwrap()
|
||||
Summary::new(pkgid, Vec::new(), &BTreeMap::<String, Vec<String>>::new(), link, false).unwrap()
|
||||
})
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ fn pkg(name: &str) -> Summary {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
Summary::new(pkg_id(name), Vec::new(), BTreeMap::<String, Vec<String>>::new(), link, false).unwrap()
|
||||
Summary::new(pkg_id(name), Vec::new(), &BTreeMap::<String, Vec<String>>::new(), link, false).unwrap()
|
||||
}
|
||||
|
||||
fn pkg_id(name: &str) -> PackageId {
|
||||
@ -145,7 +145,7 @@ fn pkg_loc(name: &str, loc: &str) -> Summary {
|
||||
Summary::new(
|
||||
pkg_id_loc(name, loc),
|
||||
Vec::new(),
|
||||
BTreeMap::<String, Vec<String>>::new(),
|
||||
&BTreeMap::<String, Vec<String>>::new(),
|
||||
link,
|
||||
false,
|
||||
).unwrap()
|
||||
|
Loading…
x
Reference in New Issue
Block a user