@@ -102,31 +102,14 @@ mod rustfluent {
102102 // raising a TypeError if not.
103103 if python_value. is_instance_of :: < PyString > ( ) {
104104 args. set ( key, python_value. to_string ( ) ) ;
105- } else if python_value. is_instance_of :: < PyInt > ( ) {
106- match python_value. extract :: < i32 > ( ) {
107- Ok ( int_value) => {
108- args. set ( key, int_value) ;
109- }
110- _ => {
111- // The Python integer overflowed i32.
112- // Fall back to displaying the variable key as its value.
113- let fallback_value = key. clone ( ) ;
114- args. set ( key, fallback_value) ;
115- }
116- }
117- } else if python_value. is_instance_of :: < PyDate > ( ) {
118- // Display the Python date as YYYY-MM-DD.
119- match python_value. extract :: < NaiveDate > ( ) {
120- Ok ( chrono_date) => {
121- args. set ( key, chrono_date. format ( "%Y-%m-%d" ) . to_string ( ) ) ;
122- }
123- _ => {
124- // Could not convert.
125- // Fall back to displaying the variable key as its value.
126- let fallback_value = key. clone ( ) ;
127- args. set ( key, fallback_value) ;
128- }
129- }
105+ } else if python_value. is_instance_of :: < PyInt > ( )
106+ && let Ok ( int_value) = python_value. extract :: < i32 > ( )
107+ {
108+ args. set ( key, int_value) ;
109+ } else if python_value. is_instance_of :: < PyDate > ( )
110+ && let Ok ( chrono_date) = python_value. extract :: < NaiveDate > ( )
111+ {
112+ args. set ( key, chrono_date. format ( "%Y-%m-%d" ) . to_string ( ) ) ;
130113 } else {
131114 // The variable value was of an unsupported type.
132115 // Fall back to displaying the variable key as its value.
0 commit comments