rust/src/test/rustdoc/check-styled-link.rs
Michael Howell 6516f9408e rustdoc: use more precise relative URLS
Instead of using a depth counter and adding "../" to get to the top,
this commit makes rustdoc actually compare the path of what it's
linking from to the path that it's linking to. This makes the resulting
HTML shorter.

Here's a comparison of one of the largest (non-source) files in the
Rust standard library docs (about 4% improvement before gzipping).

    $ wc -c struct.Wrapping.old.html struct.Wrapping.new.html
    2387389 struct.Wrapping.old.html
    2298538 struct.Wrapping.new.html

Most if it can be efficiently gzipped away.

    $ wc -c struct.Wrapping.old.html.gz struct.Wrapping.new.html.gz
    70679 struct.Wrapping.old.html.gz
    70050 struct.Wrapping.new.html.gz

But it also makes a difference in the final DOM size, reducing it from 91MiB to 82MiB.
2021-04-17 09:21:52 -07:00

9 lines
161 B
Rust

#![crate_name = "foo"]
pub struct Foo;
// @has foo/struct.Bar.html '//a[@href="struct.Foo.html"]' 'Foo'
/// Code-styled reference to [`Foo`].
pub struct Bar;