Skip to content

Commit 62153f7

Browse files
committed
rfc, self_in_typedefs: update Unresolved questions.
1 parent e9bbd2b commit 62153f7

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

text/0000-self-in-typedefs.md

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -603,37 +603,4 @@ is preferred.
603603
# Unresolved questions
604604
[unresolved]: #unresolved-questions
605605

606-
## Should the migration advice be to use `Self` instead of the concrete type?
607-
608-
In the [migration advice] we suggest that `clippy` should encourage users to
609-
move towards using `Self` instead of the concrete type. This RFC currently
610-
argues that this should be best practice.
611-
612-
However, there is some concern that the reading code that pervasively uses
613-
`Self` across the board adds a level of indirection since readers are often
614-
interested in the concrete type instead of just knowing that it is the `Self`
615-
type. To mitigate this indirection, it is possible to improve `rustdoc` such
616-
that you can hover `Self` and its associated types (if there are any) to see
617-
what the concrete type is. Hovering can reduce the degree to which you have
618-
to jump to see what the concrete type is.
619-
620-
Furthermore, the level of indirection introduced by using `Self` is not much.
621-
Only one level of indirection is introduced.
622-
623-
With respect to type definitions specifically, there usually are few enough
624-
variants that you can keep the header `enum Foo {` in visual scope in your editor.
625-
Therefore, you can quickly see what the concrete type is.
626-
627-
When you are dealing with complex types, `Self` can also be easier to read
628-
as you can syntax-highlight for it easily and provide a distinct color for it.
629-
630-
Using `Self` or an associated type of `Self` such as in `-> Option<Self::Item>`
631-
also provides information about the context we are dealing with in the case of
632-
traits. Writing out the concrete type can therefore make patterns harder to see.
633-
634-
However, the standard library currently writes out the associated type. This
635-
can be seen in the case of `Iterator`, where instead of writing
636-
`fn next(&mut self) -> Option<Self::Item>` the standard library will use
637-
`fn next(&mut self) -> Option<SomeConcreteType>`.
638-
639-
There are no other unresolved questions.
606+
There are no unresolved questions.

0 commit comments

Comments
 (0)