Description
I find the "Trait Implementations" section of Rustdoc very hard to follow. It has low signal to noise ratio:
-
Very common traits are displayed in full detail. For traits like
Copy
,Clone
,Default
,Display
,Debug
,Hash
, etc. I don't need to see all the methods inline with their description. Just links to these traits would be enough. Generally I only need to know whether the type implements them or not. -
Similarly, traits used via operators are also displayed in full detail.
Eq
,PartialEq
,Add
,Sub
,Ord
,PartialOrd
, etc. flood the documentation page with documentation of the traits, and the specific methods are even less relevant. The long verbose list makes it hard to see which traits are supported. -
If the type implements the same trait multiple times for slightly different types, the whole trait documentation is repeated multiple times. It is useful to know which type combinations are supported, but repeated function descriptions only lower signal to noise ratio. It's worst for primitive types where the list appears to be dominated by countless the variants of
Shr
andShl
, drowning out all other information.
The current layout does work well for less common/more specific traits, e.g. having entire trait documentation inlined is perfect for *Ext
traits and makes sense in some cases like impl Read for File
.
So I'm suggesting:
-
Implement collapsing widget for trait implementations, which collapses documentation of methods, leaving only
[+] impl Trait for Foo
line. -
Collapse basic traits by default (
Copy
,Clone
,Debug
,std::ops::*
, etc.). Not all traits instd
are obvious, so the list of traits to display in a terse form would probably be manually curated. -
Group implementations of the same trait together, and collapse all implementations except one. For example
File
displays all ofRead
docs twice, in two separate places. It makes the list longer and makes it harder to notice that there are two implementations. It would be clearer to display it as:[+] impl Read for File
[-] impl<'a> Read for &'a File
fn read(&mut self) …