Skip to content

Commit

Permalink
docs(cargo): Clarify sort_summaries behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Nov 9, 2023
1 parent 1b10550 commit 46bb8ee
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/cargo/core/resolver/version_prefs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,17 @@ impl VersionPreferences {
self.max_rust_version = ver;
}

/// Sort the given vector of summaries in-place, with all summaries presumed to be for
/// the same package. Preferred versions appear first in the result, sorted by
/// `version_ordering`, followed by non-preferred versions sorted the same way.
/// Sort (and filter) the given vector of summaries in-place
///
/// Note: all summaries presumed to be for the same package.
///
/// Sort order:
/// 1. Preferred packages
/// 2. `first_version`, falling back to [`VersionPreferences::version_ordering`] when `None`
///
/// Filtering:
/// - [`VersionPreferences::max_rust_version`]
/// - `first_version`
pub fn sort_summaries(
&self,
summaries: &mut Vec<Summary>,
Expand Down

0 comments on commit 46bb8ee

Please sign in to comment.