@@ -123,7 +123,7 @@ impl Radix {
123123}
124124
125125#[ derive( Debug ) ]
126- pub ( super ) struct DigitInfo < ' a > {
126+ pub ( super ) struct NumericLiteral < ' a > {
127127 /// Which radix the literal was represented in.
128128 crate radix : Radix ,
129129 /// The radix prefix, if present.
@@ -140,12 +140,12 @@ pub(super) struct DigitInfo<'a> {
140140 crate suffix : Option < & ' a str > ,
141141}
142142
143- impl < ' a > DigitInfo < ' a > {
144- fn from_lit ( src : & ' a str , lit : & Lit ) -> Option < DigitInfo < ' a > > {
143+ impl < ' a > NumericLiteral < ' a > {
144+ fn from_lit ( src : & ' a str , lit : & Lit ) -> Option < NumericLiteral < ' a > > {
145145 if lit. kind . is_numeric ( ) && src. chars ( ) . next ( ) . map_or ( false , |c| c. is_digit ( 10 ) ) {
146146 let ( unsuffixed, suffix) = split_suffix ( & src, & lit. kind ) ;
147147 let float = if let LitKind :: Float ( ..) = lit. kind { true } else { false } ;
148- Some ( DigitInfo :: new ( unsuffixed, suffix, float) )
148+ Some ( NumericLiteral :: new ( unsuffixed, suffix, float) )
149149 } else {
150150 None
151151 }
@@ -400,21 +400,21 @@ impl LiteralDigitGrouping {
400400
401401 if_chain ! {
402402 if let Some ( src) = snippet_opt( cx, lit. span) ;
403- if let Some ( mut digit_info ) = DigitInfo :: from_lit( & src, & lit) ;
403+ if let Some ( mut num_lit ) = NumericLiteral :: from_lit( & src, & lit) ;
404404 then {
405- if !Self :: check_for_mistyped_suffix( cx, lit. span, & mut digit_info ) {
405+ if !Self :: check_for_mistyped_suffix( cx, lit. span, & mut num_lit ) {
406406 return ;
407407 }
408408
409409 let result = ( || {
410410
411- let integral_group_size = Self :: get_group_size( digit_info . integer. split( '_' ) , in_macro) ?;
412- if let Some ( fraction) = digit_info . fraction {
411+ let integral_group_size = Self :: get_group_size( num_lit . integer. split( '_' ) , in_macro) ?;
412+ if let Some ( fraction) = num_lit . fraction {
413413 let fractional_group_size = Self :: get_group_size( fraction. rsplit( '_' ) , in_macro) ?;
414414
415415 let consistent = Self :: parts_consistent( integral_group_size,
416416 fractional_group_size,
417- digit_info . integer. len( ) ,
417+ num_lit . integer. len( ) ,
418418 fraction. len( ) ) ;
419419 if !consistent {
420420 return Err ( WarningType :: InconsistentDigitGrouping ) ;
@@ -425,7 +425,7 @@ impl LiteralDigitGrouping {
425425
426426
427427 if let Err ( warning_type) = result {
428- warning_type. display( & digit_info . grouping_hint( ) , cx, lit. span)
428+ warning_type. display( & num_lit . grouping_hint( ) , cx, lit. span)
429429 }
430430 }
431431 }
@@ -435,25 +435,25 @@ impl LiteralDigitGrouping {
435435 fn check_for_mistyped_suffix (
436436 cx : & EarlyContext < ' _ > ,
437437 span : syntax_pos:: Span ,
438- digit_info : & mut DigitInfo < ' _ > ,
438+ num_lit : & mut NumericLiteral < ' _ > ,
439439 ) -> bool {
440- if digit_info . suffix . is_some ( ) {
440+ if num_lit . suffix . is_some ( ) {
441441 return true ;
442442 }
443443
444- let ( part, mistyped_suffixes, missing_char) = if let Some ( ( _, exponent) ) = & mut digit_info . exponent {
444+ let ( part, mistyped_suffixes, missing_char) = if let Some ( ( _, exponent) ) = & mut num_lit . exponent {
445445 ( exponent, & [ "32" , "64" ] [ ..] , 'f' )
446- } else if let Some ( fraction) = & mut digit_info . fraction {
446+ } else if let Some ( fraction) = & mut num_lit . fraction {
447447 ( fraction, & [ "32" , "64" ] [ ..] , 'f' )
448448 } else {
449- ( & mut digit_info . integer , & [ "8" , "16" , "32" , "64" ] [ ..] , 'i' )
449+ ( & mut num_lit . integer , & [ "8" , "16" , "32" , "64" ] [ ..] , 'i' )
450450 } ;
451451
452452 let mut split = part. rsplit ( '_' ) ;
453453 let last_group = split. next ( ) . expect ( "At least one group" ) ;
454454 if split. next ( ) . is_some ( ) && mistyped_suffixes. contains ( & last_group) {
455455 * part = & part[ ..part. len ( ) - last_group. len ( ) ] ;
456- let mut hint = digit_info . grouping_hint ( ) ;
456+ let mut hint = num_lit . grouping_hint ( ) ;
457457 hint. push ( '_' ) ;
458458 hint. push ( missing_char) ;
459459 hint. push_str ( last_group) ;
@@ -539,14 +539,14 @@ impl DecimalLiteralRepresentation {
539539 if_chain ! {
540540 if let LitKind :: Int ( val, _) = lit. kind;
541541 if let Some ( src) = snippet_opt( cx, lit. span) ;
542- if let Some ( digit_info ) = DigitInfo :: from_lit( & src, & lit) ;
543- if digit_info . radix == Radix :: Decimal ;
542+ if let Some ( num_lit ) = NumericLiteral :: from_lit( & src, & lit) ;
543+ if num_lit . radix == Radix :: Decimal ;
544544 if val >= u128 :: from( self . threshold) ;
545545 then {
546546 let hex = format!( "{:#X}" , val) ;
547- let digit_info = DigitInfo :: new( & hex, None , false ) ;
548- let _ = Self :: do_lint( digit_info . integer) . map_err( |warning_type| {
549- warning_type. display( & digit_info . grouping_hint( ) , cx, lit. span)
547+ let num_lit = NumericLiteral :: new( & hex, None , false ) ;
548+ let _ = Self :: do_lint( num_lit . integer) . map_err( |warning_type| {
549+ warning_type. display( & num_lit . grouping_hint( ) , cx, lit. span)
550550 } ) ;
551551 }
552552 }
0 commit comments