Fix misleading description contains docstring (#4783)

## Summary

This doesn't include pre-releases by default. Maybe it did at one point!
This commit is contained in:
Charlie Marsh 2024-07-03 14:28:40 -04:00 committed by GitHub
parent c17761904e
commit 814b3c45bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -462,20 +462,13 @@ impl VersionSpecifier {
} }
} }
/// Whether the given version satisfies the version range /// Whether the given version satisfies the version range.
/// ///
/// e.g. `>=1.19,<2.0` and `1.21` -> true /// For example, `>=1.19,<2.0` contains `1.21`, but not `2.0`.
/// <https://peps.python.org/pep-0440/#version-specifiers>
/// ///
/// Unlike `pypa/packaging`, prereleases are included by default /// See:
/// /// - <https://peps.python.org/pep-0440/#version-specifiers>
/// I'm utterly non-confident in the description in PEP 440 and apparently even pip got some /// - <https://github.com/pypa/packaging/blob/e184feef1a28a5c574ec41f5c263a3a573861f5a/packaging/specifiers.py#L362-L496>
/// of that wrong, e.g. <https://github.com/pypa/pip/issues/9121> and
/// <https://github.com/pypa/pip/issues/5503>, and also i'm not sure if it produces the correct
/// behaviour from a user perspective
///
/// This implementation is as close as possible to
/// <https://github.com/pypa/packaging/blob/e184feef1a28a5c574ec41f5c263a3a573861f5a/packaging/specifiers.py#L362-L496>
pub fn contains(&self, version: &Version) -> bool { pub fn contains(&self, version: &Version) -> bool {
// "Except where specifically noted below, local version identifiers MUST NOT be permitted // "Except where specifically noted below, local version identifiers MUST NOT be permitted
// in version specifiers, and local version labels MUST be ignored entirely when checking // in version specifiers, and local version labels MUST be ignored entirely when checking