@@ -26,7 +26,7 @@ pub trait Provider<'conn> {
26
26
let cursor = self
27
27
. get_connection ( )
28
28
. prepare ( & sql)
29
- . map_err ( |e| format ! ( "error=`{:?}, SQL=`{}`" , e, & sql. replace( " \n " , " " ) . trim( ) ) ) ?
29
+ . map_err ( |e| format ! ( "error=`{:?}, SQL=`{}`" , e, & sql. replace( '\n' , " " ) . trim( ) ) ) ?
30
30
. into_cursor ( )
31
31
. bind ( params) ?;
32
32
let iterator = EntityCursor :: new ( cursor) ;
@@ -42,7 +42,6 @@ pub trait Provider<'conn> {
42
42
#[ cfg( test) ]
43
43
mod tests {
44
44
use super :: super :: { entity:: HydrationError , ProjectionField , SqLiteEntity } ;
45
-
46
45
use super :: * ;
47
46
48
47
#[ derive( Debug , PartialEq ) ]
@@ -74,7 +73,7 @@ mod tests {
74
73
}
75
74
76
75
fn set_field ( & mut self , field : ProjectionField ) {
77
- let _ = self . fields . push ( field) ;
76
+ self . fields . push ( field) ;
78
77
}
79
78
}
80
79
@@ -179,8 +178,8 @@ returning {projection}
179
178
"
180
179
drop table if exists provider_test;
181
180
create table provider_test(text_data text not null primary key, real_data real not null, integer_data integer not null, maybe_null integer);
182
- insert into provider_test(text_data, real_data, integer_data, maybe_null) values ('row 1', 3.14 , -52, null);
183
- insert into provider_test(text_data, real_data, integer_data, maybe_null) values ('row 2', 2.72 , 1789, 0);
181
+ insert into provider_test(text_data, real_data, integer_data, maybe_null) values ('row 1', 1.23 , -52, null);
182
+ insert into provider_test(text_data, real_data, integer_data, maybe_null) values ('row 2', 2.34 , 1789, 0);
184
183
" ,
185
184
)
186
185
. unwrap ( ) ;
@@ -198,7 +197,7 @@ returning {projection}
198
197
assert_eq ! (
199
198
TestEntity {
200
199
text_data: "row 1" . to_string( ) ,
201
- real_data: 3.14 ,
200
+ real_data: 1.23 ,
202
201
integer_data: -52 ,
203
202
maybe_null: None
204
203
} ,
@@ -210,7 +209,7 @@ returning {projection}
210
209
assert_eq ! (
211
210
TestEntity {
212
211
text_data: "row 2" . to_string( ) ,
213
- real_data: 2.72 ,
212
+ real_data: 2.34 ,
214
213
integer_data: 1789 ,
215
214
maybe_null: Some ( 0 )
216
215
} ,
@@ -232,7 +231,7 @@ returning {projection}
232
231
assert_eq ! (
233
232
TestEntity {
234
233
text_data: "row 2" . to_string( ) ,
235
- real_data: 2.72 ,
234
+ real_data: 2.34 ,
236
235
integer_data: 1789 ,
237
236
maybe_null: Some ( 0 )
238
237
} ,
@@ -245,18 +244,15 @@ returning {projection}
245
244
pub fn test_parameters ( ) {
246
245
let provider = TestEntityProvider :: new ( init_database ( ) ) ;
247
246
let mut cursor = provider
248
- . find (
249
- Some ( "text_data like ?" ) ,
250
- & [ Value :: String ( "%1" . to_string ( ) ) ] . to_vec ( ) ,
251
- )
247
+ . find ( Some ( "text_data like ?" ) , & [ Value :: String ( "%1" . to_string ( ) ) ] )
252
248
. unwrap ( ) ;
253
249
let entity = cursor
254
250
. next ( )
255
251
. expect ( "there shoud be one result, none returned" ) ;
256
252
assert_eq ! (
257
253
TestEntity {
258
254
text_data: "row 1" . to_string( ) ,
259
- real_data: 3.14 ,
255
+ real_data: 1.23 ,
260
256
integer_data: -52 ,
261
257
maybe_null: None
262
258
} ,
0 commit comments