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> {
189189 Other { from_ty : Ty < ' tcx > , to_ty : Ty < ' tcx > } ,
190190}
191191
192+ /// Remove references so long as both types are references.
192193fn reduce_refs < ' tcx > (
193194 cx : & LateContext < ' tcx > ,
194195 span : Span ,
@@ -227,13 +228,21 @@ fn reduce_refs<'tcx>(
227228}
228229
229230enum ReducedTy < ' tcx > {
231+ /// The type is a struct containing either zero sized fields, or multiple sized fields with a
232+ /// defined order.
230233 OrderedFields ( Ty < ' tcx > ) ,
234+ /// The type is a struct containing multiple non-zero sized fields with no defined order.
231235 UnorderedFields ( Ty < ' tcx > ) ,
236+ /// The type is a reference to the contained type.
232237 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.
234240 IntArray ,
241+ /// Any other type.
242+ Other ( Ty < ' tcx > ) ,
235243}
236244
245+ /// Reduce structs containing a single non-zero sized field to it's contained type.
237246fn reduce_ty < ' tcx > ( cx : & LateContext < ' tcx > , mut ty : Ty < ' tcx > ) -> ReducedTy < ' tcx > {
238247 loop {
239248 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