Skip to content

Commit 46bb8ee

Browse files
committed
docs(cargo): Clarify sort_summaries behavior
1 parent 1b10550 commit 46bb8ee

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/cargo/core/resolver/version_prefs.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,17 @@ impl VersionPreferences {
5252
self.max_rust_version = ver;
5353
}
5454

55-
/// Sort the given vector of summaries in-place, with all summaries presumed to be for
56-
/// the same package. Preferred versions appear first in the result, sorted by
57-
/// `version_ordering`, followed by non-preferred versions sorted the same way.
55+
/// Sort (and filter) the given vector of summaries in-place
56+
///
57+
/// Note: all summaries presumed to be for the same package.
58+
///
59+
/// Sort order:
60+
/// 1. Preferred packages
61+
/// 2. `first_version`, falling back to [`VersionPreferences::version_ordering`] when `None`
62+
///
63+
/// Filtering:
64+
/// - [`VersionPreferences::max_rust_version`]
65+
/// - `first_version`
5866
pub fn sort_summaries(
5967
&self,
6068
summaries: &mut Vec<Summary>,

0 commit comments

Comments
 (0)