[IDEA] Implied enum types

If anything, T::default() gets used because it's shorter than Default::default(). There's an unstable fn default which exists to make it possible to just write default(), even. It's a fairly common request to be able to use path::to::Trait::function; to be able to write function() instead of Trait::function(); the example almost always used in this request is Default::default.

So yeah, while it's not uncommon for people to prefer T::default() over Default::default(), it's at least as not uncommon for people to use Default::default().

If you've ever seen/used .collect() or .into(), it's the exact same inference of generic return type as with Default::default(), but even more inconvenient to avoid relying on inference backflow.

2 Likes