@@ -372,10 +372,9 @@ declare_lint_pass!(Transmute => [
372372] ) ;
373373
374374impl < ' tcx > LateLintPass < ' tcx > for Transmute {
375- #[ allow( clippy:: similar_names, clippy:: too_many_lines) ]
376375 fn check_expr ( & mut self , cx : & LateContext < ' tcx > , e : & ' tcx Expr < ' _ > ) {
377376 if_chain ! {
378- if let ExprKind :: Call ( path_expr, args ) = e. kind;
377+ if let ExprKind :: Call ( path_expr, [ arg ] ) = e. kind;
379378 if let ExprKind :: Path ( ref qpath) = path_expr. kind;
380379 if let Some ( def_id) = cx. qpath_res( qpath, path_expr. hir_id) . opt_def_id( ) ;
381380 if cx. tcx. is_diagnostic_item( sym:: transmute, def_id) ;
@@ -385,28 +384,28 @@ impl<'tcx> LateLintPass<'tcx> for Transmute {
385384 // And see https://github.com/rust-lang/rust/issues/51911 for dereferencing raw pointers.
386385 let const_context = in_constant( cx, e. hir_id) ;
387386
388- let from_ty = cx. typeck_results( ) . expr_ty( & args [ 0 ] ) ;
387+ let from_ty = cx. typeck_results( ) . expr_ty( arg ) ;
389388 let to_ty = cx. typeck_results( ) . expr_ty( e) ;
390389
391390 // If useless_transmute is triggered, the other lints can be skipped.
392- if useless_transmute:: check( cx, e, from_ty, to_ty, args ) {
391+ if useless_transmute:: check( cx, e, from_ty, to_ty, arg ) {
393392 return ;
394393 }
395394
396- let mut linted = wrong_transmute:: check( cx, e, from_ty, to_ty) ;
397- linted |= crosspointer_transmute:: check( cx, e, from_ty, to_ty) ;
398- linted |= transmute_ptr_to_ref:: check( cx, e, from_ty, to_ty, args , qpath) ;
399- linted |= transmute_int_to_char:: check( cx, e, from_ty, to_ty, args ) ;
400- linted |= transmute_ref_to_ref:: check( cx, e, from_ty, to_ty, args , const_context) ;
401- linted |= transmute_ptr_to_ptr:: check( cx, e, from_ty, to_ty, args ) ;
402- linted |= transmute_int_to_bool:: check( cx, e, from_ty, to_ty, args ) ;
403- linted |= transmute_int_to_float:: check( cx, e, from_ty, to_ty, args , const_context) ;
404- linted |= transmute_float_to_int:: check( cx, e, from_ty, to_ty, args , const_context) ;
405- linted |= transmute_num_to_bytes:: check( cx, e, from_ty, to_ty, args , const_context) ;
406- linted |= unsound_collection_transmute:: check( cx, e, from_ty, to_ty) ;
395+ let linted = wrong_transmute:: check( cx, e, from_ty, to_ty)
396+ | crosspointer_transmute:: check( cx, e, from_ty, to_ty)
397+ | transmute_ptr_to_ref:: check( cx, e, from_ty, to_ty, arg , qpath)
398+ | transmute_int_to_char:: check( cx, e, from_ty, to_ty, arg )
399+ | transmute_ref_to_ref:: check( cx, e, from_ty, to_ty, arg , const_context)
400+ | transmute_ptr_to_ptr:: check( cx, e, from_ty, to_ty, arg )
401+ | transmute_int_to_bool:: check( cx, e, from_ty, to_ty, arg )
402+ | transmute_int_to_float:: check( cx, e, from_ty, to_ty, arg , const_context)
403+ | transmute_float_to_int:: check( cx, e, from_ty, to_ty, arg , const_context)
404+ | transmute_num_to_bytes:: check( cx, e, from_ty, to_ty, arg , const_context)
405+ | unsound_collection_transmute:: check( cx, e, from_ty, to_ty) ;
407406
408407 if !linted {
409- transmutes_expressible_as_ptr_casts:: check( cx, e, from_ty, to_ty, args ) ;
408+ transmutes_expressible_as_ptr_casts:: check( cx, e, from_ty, to_ty, arg ) ;
410409 }
411410 }
412411 }
0 commit comments