pep508: fix doc test

Indented blocks in Markdown are treated as code blocks, and rustdoc
treats all unadorned code blocks as Rust doctests. Since this wasn't
intended as a doctest and isn't valid Rust, it makes `cargo test --doc`
fail. We fix this by using an explicit code block labeled as `text`.
This commit is contained in:
Andrew Gallant 2024-08-19 17:24:16 -04:00 committed by Andrew Gallant
parent 4b501a1393
commit c14e30ad09
2 changed files with 16 additions and 10 deletions

View file

@ -257,7 +257,9 @@ pub(crate) fn parse_marker_key_op_value<T: Pep508Url>(
/// ///
/// The following limited expression is supported: /// The following limited expression is supported:
/// ///
/// ```text
/// [not] in '<version> [additional versions]' /// [not] in '<version> [additional versions]'
/// ```
/// ///
/// where the version is PEP 440 compliant. Arbitrary whitespace is allowed between versions. /// where the version is PEP 440 compliant. Arbitrary whitespace is allowed between versions.
/// ///

View file

@ -368,17 +368,21 @@ fn collapse_no_versions_of_workspace_members(
/// Given a [`DerivationTree`], collapse `NoVersions` incompatibilities that are redundant children /// Given a [`DerivationTree`], collapse `NoVersions` incompatibilities that are redundant children
/// of a dependency. For example, if we have a tree like: /// of a dependency. For example, if we have a tree like:
/// ///
/// ```text
/// A>=1,<2 depends on B /// A>=1,<2 depends on B
/// A has no versions >1,<2 /// A has no versions >1,<2
/// C depends on A>=1,<2 /// C depends on A>=1,<2
/// ```
/// ///
/// We can simplify this to `C depends A>=1 and A>=1 depends on B so C depends on B` without /// We can simplify this to `C depends A>=1 and A>=1 depends on B so C depends on B` without
/// explaining that there are no other versions of A. This is dependent on range of A in "A depends /// explaining that there are no other versions of A. This is dependent on range of A in "A depends
/// on" being a subset of range of A in "depends on A". For example, in a tree like: /// on" being a subset of range of A in "depends on A". For example, in a tree like:
/// ///
/// ```text
/// A>=1,<3 depends on B /// A>=1,<3 depends on B
/// A has no versions >2,<3 /// A has no versions >2,<3
/// C depends on A>=2,<3 /// C depends on A>=2,<3
/// ```
/// ///
/// We cannot say `C depends on A>=2 and A>=1 depends on B so C depends on B` because there is a /// We cannot say `C depends on A>=2 and A>=1 depends on B so C depends on B` because there is a
/// hole in the range — `A>=1,<3` is not a subset of `A>=2,<3`. /// hole in the range — `A>=1,<3` is not a subset of `A>=2,<3`.