@@ -41,10 +41,12 @@ pub fn style_number(mut num: i32, sub: bool) -> String {
41
41
const SUPERSCRIPT_DIGITS : [ char ; 10 ] = [ '⁰' , '¹' , '²' , '³' , '⁴' , '⁵' , '⁶' , '⁷' , '⁸' , '⁹' ] ;
42
42
const SUBSCRIPT_DIGITS : [ char ; 10 ] = [ '₀' , '₁' , '₂' , '₃' , '₄' , '₅' , '₆' , '₇' , '₈' , '₉' ] ;
43
43
44
+ let digits = if sub { SUBSCRIPT_DIGITS } else { SUPERSCRIPT_DIGITS } ;
45
+
44
46
let mut result = String :: new ( ) ;
45
47
46
48
if num == 0 {
47
- result. push ( if sub { SUBSCRIPT_DIGITS [ 0 ] } else { SUPERSCRIPT_DIGITS [ 0 ] } ) ;
49
+ result. push ( digits [ 0 ] ) ;
48
50
return result;
49
51
}
50
52
@@ -61,11 +63,7 @@ pub fn style_number(mut num: i32, sub: bool) -> String {
61
63
power_of_ten /= 10 ;
62
64
if digit != 0 || started {
63
65
started = true ;
64
- result. push ( if sub {
65
- SUBSCRIPT_DIGITS [ digit as usize ]
66
- } else {
67
- SUPERSCRIPT_DIGITS [ digit as usize ]
68
- } ) ;
66
+ result. push ( digits[ digit as usize ] )
69
67
}
70
68
}
71
69
@@ -79,7 +77,7 @@ pub mod common_tests {
79
77
use crate :: modules:: localization;
80
78
use crate :: modules:: params:: Params ;
81
79
use crate :: modules:: weather;
82
- use std:: collections:: HashSet ;
80
+ use std:: collections:: { HashMap , HashSet } ;
83
81
use std:: sync:: OnceLock ;
84
82
85
83
pub static TEST_PRODUCT : OnceLock < Product > = OnceLock :: new ( ) ;
@@ -242,7 +240,7 @@ pub mod common_tests {
242
240
precipitation_sum : None ,
243
241
} ,
244
242
} ,
245
- historical_weather : None ,
243
+ historical_weather : HashMap :: new ( ) ,
246
244
}
247
245
}
248
246
0 commit comments