Description
First example: https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#method.with_capacity
-
On the tool-tip the dark red and cyan text on a black background are very hard to read, and the use of very bold white text on a solid black background looks out of place in the documentation.
-
The traits shown are not important. Every function which returns a
Vec
will now have an information icon explaining thatVec<u8>
implementsWrite
. -
It's strange that the "information" icon on a function is related specifically to the return type of that function.
Second example: https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#method.into_boxed_slice
-
The tool-tip will arbitrarily pick the first type to display in the event that there are multiple possibilities. (In this case it picks
Box<I>
where the type parameterI
means nothing at that point) -
The modal dialog needs more spacing and probably a border.
-
Increases the inconsistency in style of the documentation. The docs used to be so simple that they did seem to have a consistent style throughout. Now rustdoc has a lot more features, and the mishmash of different styles is becoming an issue. Adding a whole new model dialog component doesn't help.
Some suggestions for improvements:
- Use a normal tool-tip
- Only show traits which are implemented for a super-set of the types returned by a function, so:
Impl. def. Return type Shown?
-----------------------------------------------
impl Write for Vec<u8> Vec<T> No
impl Write for Vec<u8> Vec<u8> Yes
impl Write for Vec<T> Vec<T> Yes
impl Write for Vec<T> Vec<u8> Yes
- Show the return type on the tool-tip, not the type which is mentioned in the impl. definition.
Overall, I don't think that putting this information in a modal is the best option. Personally I think it would make more send to just add a "Return value" section, and put the information in there. It will make the documentation for those functions more verbose, but it will reduce the complexity of the documentation as a whole, and keep everything consistent.