@@ -53,13 +53,13 @@ impl<T: Debug> LiteralLookup<T> {
53
53
for ( k, v) in expected {
54
54
let id = values. len ( ) ;
55
55
values. push ( v) ;
56
- if let Ok ( bool) = k. validate_bool ( true ) {
57
- if bool. into_inner ( ) {
56
+
57
+ if let Ok ( bool_value) = k. validate_bool ( true ) {
58
+ if bool_value. into_inner ( ) {
58
59
expected_bool. true_id = Some ( id) ;
59
60
} else {
60
61
expected_bool. false_id = Some ( id) ;
61
62
}
62
-
63
63
expected_py_primitives. push ( ( k. as_unbound ( ) . clone_ref ( py) , id) ) ;
64
64
}
65
65
if k. is_exact_instance_of :: < PyInt > ( ) {
@@ -82,30 +82,13 @@ impl<T: Debug> LiteralLookup<T> {
82
82
}
83
83
84
84
Ok ( Self {
85
- expected_bool : match expected_bool. true_id . is_some ( ) || expected_bool. false_id . is_some ( ) {
86
- true => Some ( expected_bool) ,
87
- false => None ,
88
- } ,
89
- expected_int : match expected_int. is_empty ( ) {
90
- true => None ,
91
- false => Some ( expected_int) ,
92
- } ,
93
- expected_str : match expected_str. is_empty ( ) {
94
- true => None ,
95
- false => Some ( expected_str) ,
96
- } ,
97
- expected_py_dict : match expected_py_dict. is_empty ( ) {
98
- true => None ,
99
- false => Some ( expected_py_dict. into ( ) ) ,
100
- } ,
101
- expected_py_values : match expected_py_values. is_empty ( ) {
102
- true => None ,
103
- false => Some ( expected_py_values) ,
104
- } ,
105
- expected_py_primitives : match expected_py_primitives. is_empty ( ) {
106
- true => None ,
107
- false => Some ( expected_py_primitives) ,
108
- } ,
85
+ expected_bool : ( expected_bool. true_id . is_some ( ) || expected_bool. false_id . is_some ( ) )
86
+ . then_some ( expected_bool) ,
87
+ expected_int : ( !expected_int. is_empty ( ) ) . then_some ( expected_int) ,
88
+ expected_str : ( !expected_str. is_empty ( ) ) . then_some ( expected_str) ,
89
+ expected_py_dict : ( !expected_py_dict. is_empty ( ) ) . then_some ( expected_py_dict. into ( ) ) ,
90
+ expected_py_values : ( !expected_py_values. is_empty ( ) ) . then_some ( expected_py_values) ,
91
+ expected_py_primitives : ( !expected_py_primitives. is_empty ( ) ) . then_some ( expected_py_primitives) ,
109
92
values,
110
93
} )
111
94
}
0 commit comments