diff --git a/src/cmd/path.rs b/src/cmd/path.rs index 90d0e28a..5c0eedce 100644 --- a/src/cmd/path.rs +++ b/src/cmd/path.rs @@ -45,7 +45,7 @@ pub fn run(sess: &Session, args: &PathArgs) -> Result<()> { if args.checkout || !paths.iter().all(|p| p.exists()) { debugln!("main: obtain checkouts {:?}", ids); let rt = Runtime::new()?; - let checkouts = rt + let _checkouts = rt .block_on(join_all( ids.iter() .map(|&(_, id)| io.checkout(id, false, &[])) @@ -53,7 +53,7 @@ pub fn run(sess: &Session, args: &PathArgs) -> Result<()> { )) .into_iter() .collect::>>()?; - debugln!("main: checkouts {:#?}", checkouts); + debugln!("main: checkouts {:#?}", _checkouts); } // Print paths diff --git a/src/error.rs b/src/error.rs index b67ad615..02a1b9cc 100644 --- a/src/error.rs +++ b/src/error.rs @@ -45,9 +45,7 @@ macro_rules! stageln { #[macro_export] #[cfg(not(debug_assertions))] macro_rules! debugln { - ($fmt:expr $(, $arg:expr)* $(,)?) => { $(let _ = $arg;)* } - // create an unused binding here so the compiler does not complain - // about the arguments to debugln! not being used in release builds. + ($($arg:tt)*) => {}; } /// Emit a diagnostic message. diff --git a/src/resolver.rs b/src/resolver.rs index e47d2fe9..3bc5d6e9 100644 --- a/src/resolver.rs +++ b/src/resolver.rs @@ -148,15 +148,15 @@ impl<'ctx> DependencyResolver<'ctx> { &io, )?; - let mut iteration = 0; + let mut _iteration = 0; let mut any_changes = true; while any_changes { debugln!( "resolve: iteration {} table {:#?}", - iteration, + _iteration, TableDumper(&self.table) ); - iteration += 1; + _iteration += 1; // Constraint all dependencies with state `Open` -> `Constrained`. self.init()?; @@ -171,7 +171,7 @@ impl<'ctx> DependencyResolver<'ctx> { // Close the dependency set. any_changes |= self.close(&rt, &io)?; } - debugln!("resolve: resolved after {} iterations", iteration); + debugln!("resolve: resolved after {} iterations", _iteration); // Convert the resolved dependencies into a lockfile. let sess = self.sess; @@ -583,7 +583,7 @@ impl<'ctx> DependencyResolver<'ctx> { map }; - let src_cons_map = cons_map + let _src_cons_map = cons_map .iter() .map(|(name, cons)| { ( @@ -599,7 +599,7 @@ impl<'ctx> DependencyResolver<'ctx> { debugln!( "resolve: gathered constraints {:#?}", - ConstraintsDumper(&src_cons_map) + ConstraintsDumper(&_src_cons_map) ); // Impose the constraints on the dependencies. @@ -991,16 +991,22 @@ impl<'ctx> DependencyResolver<'ctx> { .map(|(a, b, c)| (a, (b, c))) .collect::)>>(); // TODO: pick among possible sources. - debugln!( - "resolve: picking ref {} for `{}`", - src_map.first().unwrap().0, - dep.name - ); - State::Picked( - *src_map.first().unwrap().0, - src_map.first().unwrap().1.0, - src_map.into_iter().map(|(k, (_, ids))| (k, ids)).collect(), - ) + match src_map.first() { + Some(first) => { + debugln!("resolve: picking ref {} for `{}`", first.0, dep.name); + State::Picked( + *first.0, + first.1.0, + src_map.into_iter().map(|(k, (_, ids))| (k, ids)).collect(), + ) + } + None => { + return Err(Error::new(format!( + "No versions available for `{}`. This may be due to a conflict in the dependency requirements.", + dep.name + ))); + } + } } State::Picked(dref, id, map) => { if !dep.sources[dref].is_path() && !map[dref].contains(id) { @@ -1201,6 +1207,7 @@ impl State { } } +#[allow(dead_code)] struct TableDumper<'a>(&'a IndexMap<&'a str, Dependency<'a>>); impl fmt::Debug for TableDumper<'_> { @@ -1232,6 +1239,7 @@ impl fmt::Debug for TableDumper<'_> { } } +#[allow(dead_code)] struct ConstraintsDumper<'a>( &'a IndexMap<&'a str, Vec<(&'a str, DependencyConstraint, DependencySource)>>, ); diff --git a/src/sess.rs b/src/sess.rs index e2c1bd74..f148bced 100644 --- a/src/sess.rs +++ b/src/sess.rs @@ -145,13 +145,13 @@ impl<'ctx> Session<'ctx> { &self, name: &str, cfg: &config::Dependency, - calling_package: &str, + _calling_package: &str, ) -> DependencyRef { debugln!( "sess: load dependency `{}` as {:?} for package `{}`", name, cfg, - calling_package + _calling_package ); let src = DependencySource::from(cfg); self.deps @@ -952,10 +952,10 @@ impl<'io, 'sess: 'io, 'ctx: 'sess> SessionIo<'sess, 'ctx> { .await { Ok(r) => Ok(r), - Err(cause) => { + Err(_cause) => { debugln!( "checkout_git: failed to tag commit {:?}, attempting fetch.", - cause + _cause ); let pb = Some(ProgressHandler::new( self.sess.multiprogress.clone(),