Skip to content

rustdoc: Add item types to all page titles #34345

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

Closed
wants to merge 1 commit into from

Conversation

ollie27
Copy link
Member

@ollie27 ollie27 commented Jun 18, 2016

No description provided.

@rust-highfive
Copy link
Contributor

r? @steveklabnik

(rust_highfive has picked a reviewer for you, use r? to override)

@GuillaumeGomez
Copy link
Member

Do you have an online doc with this change please?

@ollie27
Copy link
Member Author

ollie27 commented Jun 19, 2016

Sure, I've uploaded this change to https://ollie27.github.io/rust_doc_test/std/. See before, after for example.

@GuillaumeGomez
Copy link
Member

Like I thought, I don't like this change. :-/

cc @steveklabnik
cc @Manishearth

@ollie27
Copy link
Member Author

ollie27 commented Jun 20, 2016

The item type is already in the title for most items: crates, modules, structs, traits, primitives etc... with inconsistencies like functions but not foreign functions. What is it about this change you don't like? Is it the the titles in general or just the types I've adding them to?

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Jun 21, 2016

I don't like "Type definition". I don't find this information interesting. For a struct or a function, it is "easy" to read. But in this case, not really. We're a bit lost in the title trying to get the useful information of what this page is about. However, this isn't a big "anti" opinion.

@steveklabnik
Copy link
Member

I am split myself. It is in some places already... @rust-lang/tools what do you think?

@brson
Copy link
Contributor

brson commented Jun 27, 2016

I think the inconsistency should be fixed, but I too think the extra verbosity of the "Type Definition" example doesn't add much. Immediately below the title is the declaration, so it's obvious it's a typedef. On the other hand there are pages where the extra title does contribute: modules, because the page doesn't show the module definition, crates for the same reason and to distinguish from modules, primitives because they are special pages.

One problem with the example is just that "Type Definition" is a mouthful - two whole words, whereas the existing examples are mostly short single words. That specific case might look more visually appealing (though less understandable) abbreviated to "Typedef".

Alternative suggestions:

  • Remove the extra text from all pages but the crate root, so that the crate is distinguished from modules. The kinds of every other item are clear enough in context.
  • Somehow put the kind (the less important info) after the name (the more important info).

clean::StaticItem(..) | clean::ForeignStaticItem(..) =>
write!(fmt, "Static ")?,
clean::ConstantItem(..) => write!(fmt, "Constant ")?,
_ => unreachable!(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it may be a bit of a refactoring hazard, could this explicitly mention the remaining cases and redirect them to unreachable!()? Perhaps with a comment as well indicating why they are indeed unreachable.

@alexcrichton
Copy link
Member

I kinda like the idea of just removing them from everything that isn't clearly disambiguated by looking at the definition inlined right afterwards. For example structs and functions don't really need the extra word because it's clear from reading the definition. Along those lines, I'd be fine leaving just modules/crates with these words and eliding all the others.

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to resubmit with comments addressed!

Manishearth added a commit to Manishearth/rust that referenced this pull request Sep 10, 2016
…bnik

rustdoc: Add missing item types to page titles

Most pages include the item type in the title such as "Struct std::vec::Vec". However it is missing from the pages for foreign functions, type definitions, macros, statics and constants. This adds them so for example, instead of a title of "std::u32::MAX" it is "Constant std::u32::MAX" to match the others.

[before](https://doc.rust-lang.org/nightly/std/u32/constant.MAX.html) [after](https://ollie27.github.io/rust_doc_test/std/u32/constant.MAX.html)
[before](https://doc.rust-lang.org/nightly/std/io/type.Result.html) [after](https://ollie27.github.io/rust_doc_test/std/io/type.Result.html)

Previous discussions: rust-lang#34345, rust-lang#35003
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Sep 10, 2016
…bnik

rustdoc: Add missing item types to page titles

Most pages include the item type in the title such as "Struct std::vec::Vec". However it is missing from the pages for foreign functions, type definitions, macros, statics and constants. This adds them so for example, instead of a title of "std::u32::MAX" it is "Constant std::u32::MAX" to match the others.

[before](https://doc.rust-lang.org/nightly/std/u32/constant.MAX.html) [after](https://ollie27.github.io/rust_doc_test/std/u32/constant.MAX.html)
[before](https://doc.rust-lang.org/nightly/std/io/type.Result.html) [after](https://ollie27.github.io/rust_doc_test/std/io/type.Result.html)

Previous discussions: rust-lang#34345, rust-lang#35003
@ollie27 ollie27 deleted the rustdoc_titles branch September 13, 2016 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants