@@ -87,7 +87,7 @@ let x: T = {
87
87
};
88
88
89
89
// With type ascription.
90
- let x: T foo(): U<_>;
90
+ let x: T = foo(): U<_>;
91
91
```
92
92
93
93
@@ -117,13 +117,14 @@ expression are exactly those of the implicit coercion.
117
117
### coercion and ` as ` vs ` : `
118
118
119
119
A downside of type ascription is the overlap with explicit coercions (aka casts,
120
- the ` as ` operator). Type ascription makes implicit coercions explicit. In RFC
121
- 401, it is proposed that all valid implicit coercions are valid explicit
122
- coercions. However, that may be too confusing for users, since there is no
123
- reason to use type ascription rather than ` as ` (if there is some coercion).
124
- Furthermore, if programmers do opt to use ` as ` as the default whether or not it
125
- is required, then it loses its function as a warning sign for programmers to
126
- beware of.
120
+ the ` as ` operator). To the programmer, type ascription makes implicit coercions
121
+ explicit (however, the compiler makes no distinction between coercions due to
122
+ type ascription and other coercions). In RFC 401, it is proposed that all valid
123
+ implicit coercions are valid explicit coercions. However, that may be too
124
+ confusing for users, since there is no reason to use type ascription rather than
125
+ ` as ` (if there is some coercion). Furthermore, if programmers do opt to use ` as `
126
+ as the default whether or not it is required, then it loses its function as a
127
+ warning sign for programmers to beware of.
127
128
128
129
To address this I propose three lints which check for: trivial casts, coercible
129
130
casts, and trivial numeric casts. Other than these lints we stick with the
0 commit comments