Remove unstable features for Rust-1.0-beta

This commit is contained in:
John Gallagher 2015-04-03 14:48:35 -05:00
parent 5e04b98840
commit 038d30e2c8
2 changed files with 7 additions and 37 deletions

View File

@ -48,15 +48,12 @@
//! }
//! }
//! ```
#![feature(unique)]
#![cfg_attr(test, feature(test))]
extern crate libc;
extern crate libsqlite3_sys as ffi;
#[macro_use] extern crate bitflags;
use std::mem;
use std::ptr::{self, Unique};
use std::ptr;
use std::fmt;
use std::path::{Path};
use std::error;
@ -153,6 +150,8 @@ pub struct SqliteConnection {
db: RefCell<InnerSqliteConnection>,
}
unsafe impl Send for SqliteConnection {}
impl SqliteConnection {
/// Open a new connection to a SQLite database.
///
@ -419,7 +418,7 @@ impl fmt::Debug for SqliteConnection {
}
struct InnerSqliteConnection {
db: Unique<ffi::Struct_sqlite3>,
db: *mut ffi::Struct_sqlite3,
}
bitflags! {
@ -463,12 +462,12 @@ impl InnerSqliteConnection {
ffi::sqlite3_close(db);
return Err(e);
}
Ok(InnerSqliteConnection{ db: Unique::new(db) })
Ok(InnerSqliteConnection{ db: db })
}
}
fn db(&self) -> *mut ffi::Struct_sqlite3 {
unsafe {self.db.get() as *const _ as *mut _}
self.db
}
fn decode_result(&mut self, code: c_int) -> SqliteResult<()> {
@ -492,7 +491,7 @@ impl InnerSqliteConnection {
fn close(&mut self) -> SqliteResult<()> {
unsafe {
let r = ffi::sqlite3_close(self.db());
self.db = Unique::new(ptr::null_mut());
self.db = ptr::null_mut();
self.decode_result(r)
}
}

View File

@ -158,7 +158,6 @@ impl<'conn> Drop for SqliteTransaction<'conn> {
#[cfg(test)]
mod test {
extern crate test;
use SqliteConnection;
fn checked_memory_handle() -> SqliteConnection {
@ -231,32 +230,4 @@ mod test {
}
assert_eq!(3i32, db.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)));
}
#[bench]
fn test_no_transaction_insert(bencher: &mut test::Bencher) {
let db = checked_memory_handle();
let mut stmt = db.prepare("INSERT INTO foo VALUES(1)").unwrap();
bencher.iter(|| {
for _ in 0i32 .. 1000 {
stmt.execute(&[]).unwrap();
}
})
}
#[bench]
fn test_transaction_insert(bencher: &mut test::Bencher) {
let db = checked_memory_handle();
let mut stmt = db.prepare("INSERT INTO foo VALUES(1)").unwrap();
bencher.iter(|| {
let mut tx = db.transaction().unwrap();
tx.set_commit();
for _ in 0i32 .. 1000 {
stmt.execute(&[]).unwrap();
}
})
}
}