File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
clippy_lints/src/transmute Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,7 @@ enum ReducedTys<'tcx> {
189
189
Other { from_ty : Ty < ' tcx > , to_ty : Ty < ' tcx > } ,
190
190
}
191
191
192
+ /// Remove references so long as both types are references.
192
193
fn reduce_refs < ' tcx > (
193
194
cx : & LateContext < ' tcx > ,
194
195
span : Span ,
@@ -227,13 +228,21 @@ fn reduce_refs<'tcx>(
227
228
}
228
229
229
230
enum ReducedTy < ' tcx > {
231
+ /// The type is a struct containing either zero sized fields, or multiple sized fields with a
232
+ /// defined order.
230
233
OrderedFields ( Ty < ' tcx > ) ,
234
+ /// The type is a struct containing multiple non-zero sized fields with no defined order.
231
235
UnorderedFields ( Ty < ' tcx > ) ,
236
+ /// The type is a reference to the contained type.
232
237
Ref ( Ty < ' tcx > ) ,
233
- Other ( Ty < ' tcx > ) ,
238
+ /// The type is an array of a primitive integer type. These can be used as storage for a value
239
+ /// of another type.
234
240
IntArray ,
241
+ /// Any other type.
242
+ Other ( Ty < ' tcx > ) ,
235
243
}
236
244
245
+ /// Reduce structs containing a single non-zero sized field to it's contained type.
237
246
fn reduce_ty < ' tcx > ( cx : & LateContext < ' tcx > , mut ty : Ty < ' tcx > ) -> ReducedTy < ' tcx > {
238
247
loop {
239
248
ty = cx. tcx . try_normalize_erasing_regions ( cx. param_env , ty) . unwrap_or ( ty) ;
You can’t perform that action at this time.
0 commit comments