Skip to content
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

rustdoc-json-types: Inconsistant spelling of type/ty #94889

Closed
aDotInTheVoid opened this issue Mar 12, 2022 · 1 comment · Fixed by #94921
Closed

rustdoc-json-types: Inconsistant spelling of type/ty #94889

aDotInTheVoid opened this issue Mar 12, 2022 · 1 comment · Fixed by #94921
Labels
A-rustdoc-json Area: Rustdoc JSON backend C-discussion Category: Discussion or questions that doesn't represent real issues. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@aDotInTheVoid
Copy link
Member

We mostly use type_: Type,

#[serde(rename = "type")]
pub type_: Type,

But sometimes use ty

Const {
ty: Type,
default: Option<String>,
},

pub enum WherePredicate {
BoundPredicate { ty: Type, bounds: Vec<GenericBound> },
RegionPredicate { lifetime: String, bounds: Vec<GenericBound> },
EqPredicate { lhs: Type, rhs: Term },
}

We should choose one and stick to it. ty is nicer to type (ha), and generaly consistant with compiller internals, but for those who don't know, type_ is much more clear, even if more ugly.

cc @CraftSpider @P1n3appl3 what do you think?

@rustbot modify labels: +A-rustdoc-json +T-rustdoc +C-discussion

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend C-discussion Category: Discussion or questions that doesn't represent real issues. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 12, 2022
@aDotInTheVoid aDotInTheVoid changed the title rustdoc-json-types: Inconsistant spelling of types rustdoc-json-types: Inconsistant spelling of type/ty Mar 12, 2022
@Enselic
Copy link
Member

Enselic commented Mar 13, 2022

I am strongly in favor of type_, because

  • It is consistent with for_, async_, trait_, etc
  • Abbreviations has no place in any public API. Clarity is paramount. (I'm sure someone can come up with exceptions, but it is my firm belief that ty is not one of them.)

bors added a commit to rust-lang-ci/rust that referenced this issue Mar 14, 2022
…anup, r=CraftSpider

rustdoc-json: Clean Up json format

No semantic changes, but better names

Closes rust-lang#94198

Closes rust-lang#94889

r? `@CraftSpider`

`@rustbot` modify labels: +A-rustdoc-json +T-rustdoc +C-cleanup
@bors bors closed this as completed in b526d8f Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend C-discussion Category: Discussion or questions that doesn't represent real issues. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants