Skip to content

Commit 93be6f2

Browse files
committed
Cut down some transmutes
1 parent d61692e commit 93be6f2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl Drop for Connection {
146146
}
147147

148148
impl Connection {
149-
fn get_cache(&self) -> &RefCell<LruCache<String, Rc<PostgresStatement<'static>>>> {
149+
fn get_cache<'a>(&'a self) -> &'a RefCell<LruCache<String, Rc<PostgresStatement<'a>>>> {
150150
unsafe { mem::transmute(self.stmts) }
151151
}
152152
}
@@ -157,11 +157,11 @@ impl GenericConnection for Connection {
157157
let mut stmts = self.get_cache().borrow_mut();
158158

159159
if let Some(stmt) = stmts.get(&query) {
160-
return Ok(unsafe { mem::transmute(stmt.clone()) });
160+
return Ok(stmt.clone());
161161
}
162162

163163
let stmt = Rc::new(try!(self.conn.prepare(query[])));
164-
stmts.put(query, unsafe { mem::transmute(stmt.clone()) });
164+
stmts.put(query, stmt.clone());
165165
Ok(stmt)
166166
}
167167

0 commit comments

Comments
 (0)