As far as I’ve understood the discussion, it’s mostly about having redundant and tedious trait bounds vs. eliding them and getting unexpected behavior.
In this case I believe that there is a third option: Explicit Elision. Instead of writing he name of the mandatory trait, you’re allowed to elide the name explicitly with an underscore (_
). This syntax is idiomatic for any rust programmer, non-redundant and it still clearly states the presence of a trait bound. Additionally, an IDE would figure out the elided type and show it to the user.
As an example, this is how the function from the first post would look like using this syntax:
fn use_set<K: _>(set: HashSet<K>) { ... }