@@ -172,7 +172,7 @@ impl ValidationRule for ImageTypeRule {
172172 }
173173
174174 // Extract Sampled Type (operand 0)
175- let sampled_type_id = match & inst. operands . get ( 0 ) {
175+ let sampled_type_id = match & inst. operands . first ( ) {
176176 Some ( Operand :: IdRef ( id) ) => Some ( * id) ,
177177 _ => None ,
178178 } ;
@@ -645,9 +645,9 @@ impl ValidationRule for ImageOperandTypeRule {
645645 inst. operands . get ( word_idx) . and_then ( |o| o. id_ref_any ( ) )
646646 {
647647 word_idx += 1 ;
648- if let Some ( type_id) = get_value_type_id ( operand_id, & ctx. definitions ) {
649- if !resolver. is_float_scalar ( type_id, & ctx. definitions )
650- || resolver. get_bit_width ( type_id, & ctx. definitions ) != Some ( 32 )
648+ if let Some ( type_id) = get_value_type_id ( operand_id, ctx. definitions ) {
649+ if !resolver. is_float_scalar ( type_id, ctx. definitions )
650+ || resolver. get_bit_width ( type_id, ctx. definitions ) != Some ( 32 )
651651 {
652652 return Err (
653653 ValidationError :: ImageOperandBiasNotFloat32Scalar {
@@ -684,15 +684,15 @@ impl ValidationRule for ImageOperandTypeRule {
684684 inst. operands . get ( word_idx) . and_then ( |o| o. id_ref_any ( ) )
685685 {
686686 word_idx += 1 ;
687- if let Some ( type_id) = get_value_type_id ( operand_id, & ctx. definitions ) {
687+ if let Some ( type_id) = get_value_type_id ( operand_id, ctx. definitions ) {
688688 let is_explicit = opcode. is_explicit_lod ( ) ;
689689 let is_gather_lod_bias_amd = opcode. is_gather ( )
690690 && ctx. has_capability ( Capability :: ImageGatherBiasLodAMD ) ;
691691
692692 if is_explicit || is_gather_lod_bias_amd {
693693 // Must be 32-bit float scalar
694- if !resolver. is_float_scalar ( type_id, & ctx. definitions )
695- || resolver. get_bit_width ( type_id, & ctx. definitions )
694+ if !resolver. is_float_scalar ( type_id, ctx. definitions )
695+ || resolver. get_bit_width ( type_id, ctx. definitions )
696696 != Some ( 32 )
697697 {
698698 return Err (
@@ -706,8 +706,8 @@ impl ValidationRule for ImageOperandTypeRule {
706706 }
707707 } else {
708708 // Must be 32-bit int scalar (for Fetch)
709- if !resolver. is_int_scalar ( type_id, & ctx. definitions )
710- || resolver. get_bit_width ( type_id, & ctx. definitions )
709+ if !resolver. is_int_scalar ( type_id, ctx. definitions )
710+ || resolver. get_bit_width ( type_id, ctx. definitions )
711711 != Some ( 32 )
712712 {
713713 return Err (
@@ -756,13 +756,13 @@ impl ValidationRule for ImageOperandTypeRule {
756756 word_idx += 1 ;
757757
758758 if let ( Some ( dx_id) , Some ( dy_id) ) = ( dx_id, dy_id) {
759- let dx_type = get_value_type_id ( dx_id, & ctx. definitions ) ;
760- let dy_type = get_value_type_id ( dy_id, & ctx. definitions ) ;
759+ let dx_type = get_value_type_id ( dx_id, ctx. definitions ) ;
760+ let dy_type = get_value_type_id ( dy_id, ctx. definitions ) ;
761761
762762 // Both must be 32-bit float scalar or vector
763763 for type_id in [ dx_type, dy_type] . into_iter ( ) . flatten ( ) {
764- if !resolver. is_float_scalar_or_vector ( type_id, & ctx. definitions )
765- || resolver. get_bit_width ( type_id, & ctx. definitions ) != Some ( 32 )
764+ if !resolver. is_float_scalar_or_vector ( type_id, ctx. definitions )
765+ || resolver. get_bit_width ( type_id, ctx. definitions ) != Some ( 32 )
766766 {
767767 return Err ( ValidationError :: ImageOperandGradNotFloat32 {
768768 function : function_id,
@@ -777,7 +777,7 @@ impl ValidationRule for ImageOperandTypeRule {
777777 if let Some ( ref info) = image_type_info {
778778 let plane_size = get_plane_coord_size ( info) ;
779779 for type_id in [ dx_type, dy_type] . into_iter ( ) . flatten ( ) {
780- let dim = resolver. get_dimension ( type_id, & ctx. definitions ) ;
780+ let dim = resolver. get_dimension ( type_id, ctx. definitions ) ;
781781 if plane_size != dim {
782782 return Err (
783783 ValidationError :: ImageOperandGradComponentCountMismatch {
@@ -801,9 +801,9 @@ impl ValidationRule for ImageOperandTypeRule {
801801 inst. operands . get ( word_idx) . and_then ( |o| o. id_ref_any ( ) )
802802 {
803803 word_idx += 1 ;
804- if let Some ( type_id) = get_value_type_id ( operand_id, & ctx. definitions ) {
805- if !resolver. is_int_scalar_or_vector ( type_id, & ctx. definitions )
806- || resolver. get_bit_width ( type_id, & ctx. definitions ) != Some ( 32 )
804+ if let Some ( type_id) = get_value_type_id ( operand_id, ctx. definitions ) {
805+ if !resolver. is_int_scalar_or_vector ( type_id, ctx. definitions )
806+ || resolver. get_bit_width ( type_id, ctx. definitions ) != Some ( 32 )
807807 {
808808 return Err ( ValidationError :: ImageOperandOffsetNotInt32 {
809809 function : function_id,
@@ -816,7 +816,7 @@ impl ValidationRule for ImageOperandTypeRule {
816816
817817 if let Some ( ref info) = image_type_info {
818818 let plane_size = get_plane_coord_size ( info) ;
819- let dim = resolver. get_dimension ( type_id, & ctx. definitions ) ;
819+ let dim = resolver. get_dimension ( type_id, ctx. definitions ) ;
820820 if plane_size != dim {
821821 return Err (
822822 ValidationError :: ImageOperandOffsetComponentCountMismatch {
@@ -834,7 +834,7 @@ impl ValidationRule for ImageOperandTypeRule {
834834 }
835835
836836 // Must be a constant
837- if !is_constant_id ( operand_id, & ctx. definitions ) {
837+ if !is_constant_id ( operand_id, ctx. definitions ) {
838838 return Err ( ValidationError :: ImageOperandConstOffsetNotConstant {
839839 function : function_id,
840840 block : block_id,
@@ -853,9 +853,9 @@ impl ValidationRule for ImageOperandTypeRule {
853853 inst. operands . get ( word_idx) . and_then ( |o| o. id_ref_any ( ) )
854854 {
855855 word_idx += 1 ;
856- if let Some ( type_id) = get_value_type_id ( operand_id, & ctx. definitions ) {
857- if !resolver. is_int_scalar_or_vector ( type_id, & ctx. definitions )
858- || resolver. get_bit_width ( type_id, & ctx. definitions ) != Some ( 32 )
856+ if let Some ( type_id) = get_value_type_id ( operand_id, ctx. definitions ) {
857+ if !resolver. is_int_scalar_or_vector ( type_id, ctx. definitions )
858+ || resolver. get_bit_width ( type_id, ctx. definitions ) != Some ( 32 )
859859 {
860860 return Err ( ValidationError :: ImageOperandOffsetNotInt32 {
861861 function : function_id,
@@ -868,7 +868,7 @@ impl ValidationRule for ImageOperandTypeRule {
868868
869869 if let Some ( ref info) = image_type_info {
870870 let plane_size = get_plane_coord_size ( info) ;
871- let dim = resolver. get_dimension ( type_id, & ctx. definitions ) ;
871+ let dim = resolver. get_dimension ( type_id, ctx. definitions ) ;
872872 if plane_size != dim {
873873 return Err (
874874 ValidationError :: ImageOperandOffsetComponentCountMismatch {
@@ -900,9 +900,9 @@ impl ValidationRule for ImageOperandTypeRule {
900900 inst. operands . get ( word_idx) . and_then ( |o| o. id_ref_any ( ) )
901901 {
902902 word_idx += 1 ;
903- if let Some ( type_id) = get_value_type_id ( operand_id, & ctx. definitions ) {
904- if !resolver. is_int_scalar ( type_id, & ctx. definitions )
905- || resolver. get_bit_width ( type_id, & ctx. definitions ) != Some ( 32 )
903+ if let Some ( type_id) = get_value_type_id ( operand_id, ctx. definitions ) {
904+ if !resolver. is_int_scalar ( type_id, ctx. definitions )
905+ || resolver. get_bit_width ( type_id, ctx. definitions ) != Some ( 32 )
906906 {
907907 return Err (
908908 ValidationError :: ImageOperandSampleNotInt32Scalar {
@@ -937,9 +937,9 @@ impl ValidationRule for ImageOperandTypeRule {
937937 inst. operands . get ( word_idx) . and_then ( |o| o. id_ref_any ( ) )
938938 {
939939 let _ = word_idx; // last operand we check
940- if let Some ( type_id) = get_value_type_id ( operand_id, & ctx. definitions ) {
941- if !resolver. is_float_scalar ( type_id, & ctx. definitions )
942- || resolver. get_bit_width ( type_id, & ctx. definitions ) != Some ( 32 )
940+ if let Some ( type_id) = get_value_type_id ( operand_id, ctx. definitions ) {
941+ if !resolver. is_float_scalar ( type_id, ctx. definitions )
942+ || resolver. get_bit_width ( type_id, ctx. definitions ) != Some ( 32 )
943943 {
944944 return Err (
945945 ValidationError :: ImageOperandMinLodNotFloat32Scalar {
0 commit comments