# Discussion: guidelines (or rules!) for annotating types for readability

**URL:** <https://internals.rust-lang.org/t/discussion-guidelines-or-rules-for-annotating-types-for-readability/10968>\
**Category:** Uncategorized\
**Created:** [September 19, 2019, 1:29pm UTC](https://internals.rust-lang.org/t/discussion-guidelines-or-rules-for-annotating-types-for-readability/10968 "2019-09-19T13:29:04Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![steveklabnik](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/steveklabnik/32/4524_2.png) [@steveklabnik](https://internals.rust-lang.org/u/steveklabnik)\
**Post date:** [September 21, 2019, 4:23pm UTC](https://internals.rust-lang.org/t/discussion-guidelines-or-rules-for-annotating-types-for-readability/10968/21 "2019-09-21T16:23:55Z")

</div>

I don’t see this trend as incongruent; I’m not arguing types are bad! I think static typing is good, and type inference is good, within limits. We’re purely discussing which limits are the right ones. I think rust’s limits (signatures must be explicitly typed, inference within bodies unless it’s ambiguous) are the right limits, and you’d prefer to not rely on inference as much.

---

<div class="post-metadata">

**Author:** ![illicitonion](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/illicitonion/32/3886_2.png) [@illicitonion](https://internals.rust-lang.org/u/illicitonion)\
**Post date:** [September 21, 2019, 10:26pm UTC](https://internals.rust-lang.org/t/discussion-guidelines-or-rules-for-annotating-types-for-readability/10968/22 "2019-09-21T22:26:54Z")

</div>

I agree that there are probably some reasonable heuristics at least.

As an example, I contributed [a Clippy lint](https://rust-lang.github.io/rust-clippy/master/index.html#default_trait_access) which looks for uses of `Default::default()` because in my opinion it's generally more clear to use a type name than a trait name in that case (e.g. `String::default()`). It's a pedantic lint, because it's pretty subjective, but I've found it useful. Perhaps this would be worth extending to all trait method accesses, or at least some other common ones (e.g. `to_owned` vs `to_string`/`to_vec`)?

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [December 20, 2019, 10:26pm UTC](https://internals.rust-lang.org/t/discussion-guidelines-or-rules-for-annotating-types-for-readability/10968/23 "2019-12-20T22:26:59Z")

</div>

Closed on December 20, 2019, 10:26pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

[Previous page](https://internals.rust-lang.org/t/discussion-guidelines-or-rules-for-annotating-types-for-readability/10968.md?page=1)
