-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert documentation to intra doc links, add default whitepoint for Lab/Lch, make code fixups #190
Conversation
Add default D65 WhitePoint to Lab and Lch Collapse if else statements in color_difference.rs Use !is_empty instead of `... > 0` comparisons in gradient.rs Use strip_prefix instead of manually stripping, avoids manual indexing Remove extraneous clones, into_iters, and closures Simplify matching on single condition to if let Remove format! in favor of to_string Fix deprecated image functions in examples Change some as casts to use direct `from` casts when applicable
I noticed the white point issue after submitting the PR, it was a quick fix so I force pushed. The commits are separated by the intra doc changes and fixups for easier review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes, this is great! I have been waiting for this feature for so long now. 😁 Time for even more cross-references in the future! And thanks a lot for the cleanup pass, too. Lots of nice changes there.
@@ -21,19 +21,19 @@ use crate::{ | |||
}; | |||
|
|||
/// Linear HSL with an alpha component. See the [`Hsla` implementation in | |||
/// `Alpha`](struct.Alpha.html#Hsla). | |||
/// `Alpha`](crate::Alpha#Hsla). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, do anchors work too? That would be amazing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and no 😅
That's using the span id=
on the impl Alpha
block for Hsl
, so anchors work but they don't seem to be so fine-grained to refer to what we want.
Line 161 in 7b8272e
///<span id="Hsla"></span>[`Hsla`](crate::Hsla) implementations. |
In the Alpha doc, the anchor for the Hsl implementation is palette/struct.Alpha.html#impl-1
.
I tried searching briefly but couldn't find anything about this. It might need to be suggested as an issue/feature request for rustdoc. It'd be great to have the anchor be the type name instead of impl-1
, which would mean no more markdown/html spans.
Otherwise, it's an amazing feature and makes cross-linking so much easier. When you use a path that doesn't exist, you get something like a lint warning but the doc build still goes through. I used cargo doc --no-deps --no-default-features --features std
with an optional --open
to quickly iterate on builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, so it's basically the same old issue. 😄 I had even forgotten about it. It's good that they work at all! I don't know if it can be improved that much more in rustdoc, considering you can have multiple impl
for types and type compositions. But I wouldn't complain if it did. 🙂
Anyway, let's merge.
bors r+ |
Build succeeded: |
Add default D65 WhitePoint to Lab and Lch
Collapse if else statements in color_difference.rs
Use !is_empty instead of
len > 0
comparisons in gradient.rsUse strip_prefix instead of manually stripping, avoids manual indexing
Remove extraneous clones, into_iters, and closures
Simplify matching on single condition into an if let
Remove format! in favor of to_string
Fix deprecated
image
functions in examplesChange some
as
casts to use directfrom
casts when applicableCloses #177