Skip to content

Commit 36660de

Browse files
weiznichTen0
andauthored
Apply suggestions from code review
Co-authored-by: Ten0 <[email protected]>
1 parent c80974e commit 36660de

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

diesel/src/sqlite/connection/bind_collector.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,13 @@ impl<'a> BindCollector<'a, Sqlite> for SqliteBindCollector<'a> {
9696
.map_err(crate::result::Error::SerializationError)?;
9797
let bind = to_sql_output.into_inner();
9898
let metadata = Sqlite::metadata(metadata_lookup);
99-
match is_null {
100-
IsNull::No => self.binds.push((bind, metadata)),
101-
IsNull::Yes => self.binds.push((SqliteBindValue::Null, metadata)),
102-
}
99+
self.binds.push((
100+
match is_null {
101+
IsNull::No => bind,
102+
IsNull::Yes => SqliteBindValue::Null,
103+
},
104+
metadata,
105+
));
103106
Ok(())
104107
}
105108
}

diesel/src/sqlite/connection/stmt.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ impl<'stmt, 'query> BoundStatement<'stmt, 'query> {
253253
{
254254
// Don't use a trait object here to prevent using a virtual function call
255255
// For sqlite this can introduce a measurable overhead
256+
// Query is boxed here to make sure it won't move in memory anymore, so any bind
257+
// it could output would stay valid.
256258
let query = Box::new(query);
257259

258260
let mut bind_collector = SqliteBindCollector::new();

0 commit comments

Comments
 (0)