Skip to content

Commit

Permalink
refactor: When expanding a range, return full versions
Browse files Browse the repository at this point in the history
  • Loading branch information
epage authored and taiki-e committed Sep 9, 2023
1 parent 8ab5385 commit af30888
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn try_main() -> Result<()> {

let total: usize = packages.iter().map(|p| p.feature_count).sum();
for cargo_version in &range {
if cx.target.is_empty() || *cargo_version >= 64 {
if cx.target.is_empty() || cargo_version.minor >= 64 {
progress.total += total;
} else {
progress.total += total * cx.target.len();
Expand All @@ -121,7 +121,7 @@ fn try_main() -> Result<()> {
versioned_cargo_exec_on_packages(
cx,
&packages,
cargo_version,
cargo_version.minor,
&mut progress,
&mut keep_going,
&mut generate_lockfile,
Expand Down
8 changes: 5 additions & 3 deletions src/rustup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub(crate) fn version_range(
step: u16,
packages: &[PackageRuns<'_>],
cx: &Context,
) -> Result<Vec<u32>> {
) -> Result<Vec<Version>> {
let check = |version: &Version| {
if version.major != 1 {
bail!("major version must be 1");
Expand Down Expand Up @@ -104,8 +104,10 @@ pub(crate) fn version_range(
MaybeVersion::Stable => get_stable_version()?,
};

let versions: Vec<_> =
(start_inclusive.minor..=end_inclusive.minor).step_by(step as _).collect();
let versions: Vec<_> = (start_inclusive.minor..=end_inclusive.minor)
.step_by(step as _)
.map(|minor| Version { major: 1, minor, patch: None })
.collect();
if versions.is_empty() {
bail!("specified version range `{range}` is empty");
}
Expand Down

0 comments on commit af30888

Please sign in to comment.