diff --git a/src/cargo/core/compiler/build_context/mod.rs b/src/cargo/core/compiler/build_context/mod.rs index 713814ad6..c069bfcfe 100644 --- a/src/cargo/core/compiler/build_context/mod.rs +++ b/src/cargo/core/compiler/build_context/mod.rs @@ -160,7 +160,7 @@ impl<'a, 'cfg> BuildContext<'a, 'cfg> { self.build_config.jobs } - pub fn rustflags_args(&self, unit: &Unit) -> CargoResult> { + pub fn rustflags_args(&self, unit: &Unit<'_>) -> CargoResult> { env_args( self.config, &self.build_config.requested_target, @@ -171,7 +171,7 @@ impl<'a, 'cfg> BuildContext<'a, 'cfg> { ) } - pub fn rustdocflags_args(&self, unit: &Unit) -> CargoResult> { + pub fn rustdocflags_args(&self, unit: &Unit<'_>) -> CargoResult> { env_args( self.config, &self.build_config.requested_target, diff --git a/src/cargo/core/compiler/build_context/target_info.rs b/src/cargo/core/compiler/build_context/target_info.rs index e263adf2f..8fa1b03f3 100644 --- a/src/cargo/core/compiler/build_context/target_info.rs +++ b/src/cargo/core/compiler/build_context/target_info.rs @@ -259,7 +259,7 @@ impl TargetInfo { fn parse_crate_type( crate_type: &str, error: &str, - lines: &mut str::Lines, + lines: &mut str::Lines<'_>, ) -> CargoResult> { let not_supported = error.lines().any(|line| { (line.contains("unsupported crate type") || line.contains("unknown crate type")) diff --git a/src/cargo/core/compiler/build_plan.rs b/src/cargo/core/compiler/build_plan.rs index 53ed9c462..2cd845cfb 100644 --- a/src/cargo/core/compiler/build_plan.rs +++ b/src/cargo/core/compiler/build_plan.rs @@ -45,7 +45,7 @@ struct SerializedBuildPlan { } impl Invocation { - pub fn new(unit: &Unit, deps: Vec) -> Invocation { + pub fn new(unit: &Unit<'_>, deps: Vec) -> Invocation { let id = unit.pkg.package_id(); Invocation { package_name: id.name().to_string(), @@ -109,7 +109,7 @@ impl BuildPlan { } } - pub fn add(&mut self, cx: &Context, unit: &Unit) -> CargoResult<()> { + pub fn add(&mut self, cx: &Context<'_, '_>, unit: &Unit<'_>) -> CargoResult<()> { let id = self.plan.invocations.len(); self.invocation_map.insert(unit.buildkey(), id); let deps = cx diff --git a/src/cargo/core/compiler/compilation.rs b/src/cargo/core/compiler/compilation.rs index 1ab0ab4e6..62b826b09 100644 --- a/src/cargo/core/compiler/compilation.rs +++ b/src/cargo/core/compiler/compilation.rs @@ -256,7 +256,7 @@ fn pre_version_component(v: &Version) -> String { ret } -fn target_runner(bcx: &BuildContext) -> CargoResult)>> { +fn target_runner(bcx: &BuildContext<'_, '_>) -> CargoResult)>> { let target = bcx.target_triple(); // try target.{}.runner diff --git a/src/cargo/core/compiler/context/compilation_files.rs b/src/cargo/core/compiler/context/compilation_files.rs index a94384c0d..34e6bc693 100644 --- a/src/cargo/core/compiler/context/compilation_files.rs +++ b/src/cargo/core/compiler/context/compilation_files.rs @@ -16,7 +16,7 @@ use crate::util::{self, CargoResult}; pub struct Metadata(u64); impl fmt::Display for Metadata { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:016x}", self.0) } } @@ -107,7 +107,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { /// Get the short hash based only on the PackageId /// Used for the metadata when target_metadata returns None - pub fn target_short_hash(&self, unit: &Unit) -> String { + pub fn target_short_hash(&self, unit: &Unit<'_>) -> String { let hashable = unit.pkg.package_id().stable_hash(self.ws.root()); util::short_hash(&hashable) } @@ -149,7 +149,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { /// Returns the directories where Rust crate dependencies are found for the /// specified unit. - pub fn deps_dir(&self, unit: &Unit) -> &Path { + pub fn deps_dir(&self, unit: &Unit<'_>) -> &Path { self.layout(unit.kind).deps() } @@ -193,7 +193,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { } /// Returns the bin stem for a given target (without metadata) - fn bin_stem(&self, unit: &Unit) -> String { + fn bin_stem(&self, unit: &Unit<'_>) -> String { if unit.target.allows_underscores() { unit.target.name().to_string() } else { diff --git a/src/cargo/core/compiler/context/mod.rs b/src/cargo/core/compiler/context/mod.rs index 27019b20c..05117aefe 100644 --- a/src/cargo/core/compiler/context/mod.rs +++ b/src/cargo/core/compiler/context/mod.rs @@ -129,7 +129,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { mut self, units: &[Unit<'a>], export_dir: Option, - exec: &Arc, + exec: &Arc, ) -> CargoResult> { let mut queue = JobQueue::new(self.bcx); let mut plan = BuildPlan::new(); @@ -386,7 +386,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { deps } - pub fn incremental_args(&self, unit: &Unit) -> CargoResult> { + pub fn incremental_args(&self, unit: &Unit<'_>) -> CargoResult> { // There's a number of ways to configure incremental compilation right // now. In order of descending priority (first is highest priority) we // have: @@ -471,7 +471,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { fn check_collistions(&self) -> CargoResult<()> { let mut output_collisions = HashMap::new(); - let describe_collision = |unit: &Unit, other_unit: &Unit, path: &PathBuf| -> String { + let describe_collision = |unit: &Unit<'_>, other_unit: &Unit<'_>, path: &PathBuf| -> String { format!( "The {} target `{}` in package `{}` has the same output \ filename as the {} target `{}` in package `{}`.\n\ @@ -487,8 +487,8 @@ impl<'a, 'cfg> Context<'a, 'cfg> { }; let suggestion = "Consider changing their names to be unique or compiling them separately.\n\ This may become a hard error in the future, see https://github.com/rust-lang/cargo/issues/6313"; - let report_collision = |unit: &Unit, - other_unit: &Unit, + let report_collision = |unit: &Unit<'_>, + other_unit: &Unit<'_>, path: &PathBuf| -> CargoResult<()> { if unit.target.name() == other_unit.target.name() { @@ -567,7 +567,7 @@ impl Links { } } - pub fn validate(&mut self, resolve: &Resolve, unit: &Unit) -> CargoResult<()> { + pub fn validate(&mut self, resolve: &Resolve, unit: &Unit<'_>) -> CargoResult<()> { if !self.validated.insert(unit.pkg.package_id()) { return Ok(()); } diff --git a/src/cargo/core/compiler/context/unit_dependencies.rs b/src/cargo/core/compiler/context/unit_dependencies.rs index 120bd284f..0bb0eb404 100644 --- a/src/cargo/core/compiler/context/unit_dependencies.rs +++ b/src/cargo/core/compiler/context/unit_dependencies.rs @@ -330,7 +330,7 @@ fn compute_deps_doc<'a, 'cfg, 'tmp>( fn maybe_lib<'a>( unit: &Unit<'a>, - bcx: &BuildContext, + bcx: &BuildContext<'_, '_>, unit_for: UnitFor, ) -> Option<(Unit<'a>, UnitFor)> { unit.pkg.targets().iter().find(|t| t.linkable()).map(|t| { @@ -347,7 +347,7 @@ fn maybe_lib<'a>( /// script itself doesn't have any dependencies, so even in that case a unit /// of work is still returned. `None` is only returned if the package has no /// build script. -fn dep_build_script<'a>(unit: &Unit<'a>, bcx: &BuildContext) -> Option<(Unit<'a>, UnitFor)> { +fn dep_build_script<'a>(unit: &Unit<'a>, bcx: &BuildContext<'_, '_>) -> Option<(Unit<'a>, UnitFor)> { unit.pkg .targets() .iter() @@ -387,7 +387,7 @@ fn check_or_build_mode(mode: CompileMode, target: &Target) -> CompileMode { } fn new_unit<'a>( - bcx: &BuildContext, + bcx: &BuildContext<'_, '_>, pkg: &'a Package, target: &'a Target, unit_for: UnitFor, @@ -420,7 +420,7 @@ fn new_unit<'a>( /// /// Here we take the entire `deps` map and add more dependencies from execution /// of one build script to execution of another build script. -fn connect_run_custom_build_deps(state: &mut State) { +fn connect_run_custom_build_deps(state: &mut State<'_, '_, '_>) { let mut new_deps = Vec::new(); { diff --git a/src/cargo/core/compiler/fingerprint.rs b/src/cargo/core/compiler/fingerprint.rs index a29aadcc7..8969f9a80 100644 --- a/src/cargo/core/compiler/fingerprint.rs +++ b/src/cargo/core/compiler/fingerprint.rs @@ -496,7 +496,7 @@ fn calculate<'a, 'cfg>( // git/registry source, then the mtime of files may fluctuate, but they won't // change so long as the source itself remains constant (which is the // responsibility of the source) -fn use_dep_info(unit: &Unit) -> bool { +fn use_dep_info(unit: &Unit<'_>) -> bool { let path = unit.pkg.summary().source_id().is_path(); !unit.mode.is_doc() && path } @@ -684,7 +684,7 @@ fn compare_old_fingerprint(loc: &Path, new_fingerprint: &Fingerprint) -> CargoRe new_fingerprint.compare(&old_fingerprint) } -fn log_compare(unit: &Unit, compare: &CargoResult<()>) { +fn log_compare(unit: &Unit<'_>, compare: &CargoResult<()>) { let ce = match *compare { Ok(..) => return, Err(ref e) => e, @@ -722,7 +722,7 @@ fn dep_info_mtime_if_fresh(pkg: &Package, dep_info: &Path) -> CargoResult