Remove most uses of #[feature(core)]

This commit is contained in:
John Gallagher 2015-03-17 00:55:28 -04:00
parent b3d949b3bb
commit 632d87de2f
3 changed files with 14 additions and 14 deletions

View File

@ -109,7 +109,7 @@ impl fmt::Display for SqliteError {
impl error::Error for SqliteError { impl error::Error for SqliteError {
fn description(&self) -> &str { fn description(&self) -> &str {
self.message.as_slice() &self.message
} }
} }
@ -900,13 +900,13 @@ mod test {
let rows = query.query(&[&4i32]).unwrap(); let rows = query.query(&[&4i32]).unwrap();
let v: Vec<i32> = rows.map(|r| r.unwrap().get(0)).collect(); let v: Vec<i32> = rows.map(|r| r.unwrap().get(0)).collect();
assert_eq!(v.as_slice(), [3i32, 2, 1].as_slice()); assert_eq!(v, [3i32, 2, 1]);
} }
{ {
let rows = query.query(&[&3i32]).unwrap(); let rows = query.query(&[&3i32]).unwrap();
let v: Vec<i32> = rows.map(|r| r.unwrap().get(0)).collect(); let v: Vec<i32> = rows.map(|r| r.unwrap().get(0)).collect();
assert_eq!(v.as_slice(), [2i32, 1].as_slice()); assert_eq!(v, [2i32, 1]);
} }
} }
@ -930,7 +930,7 @@ mod test {
let error = result.unwrap_err(); let error = result.unwrap_err();
assert!(error.code == ffi::SQLITE_NOTICE); assert!(error.code == ffi::SQLITE_NOTICE);
assert!(error.message.as_slice() == "Query did not return a row"); assert!(error.message == "Query did not return a row");
let bad_query_result = db.query_row_safe("NOT A PROPER QUERY; test123", &[], |_| ()); let bad_query_result = db.query_row_safe("NOT A PROPER QUERY; test123", &[], |_| ());
@ -943,7 +943,7 @@ mod test {
db.execute_batch("CREATE TABLE foo(x INTEGER);").unwrap(); db.execute_batch("CREATE TABLE foo(x INTEGER);").unwrap();
let err = db.prepare("SELECT * FROM does_not_exist").unwrap_err(); let err = db.prepare("SELECT * FROM does_not_exist").unwrap_err();
assert!(err.message.as_slice().contains("does_not_exist")); assert!(err.message.contains("does_not_exist"));
} }
#[test] #[test]
@ -961,7 +961,7 @@ mod test {
assert_eq!(2i32, second.get(0)); assert_eq!(2i32, second.get(0));
let result = first.get_opt::<i32>(0); let result = first.get_opt::<i32>(0);
assert!(result.unwrap_err().message.as_slice().contains("advancing to next row")); assert!(result.unwrap_err().message.contains("advancing to next row"));
} }
#[test] #[test]
@ -973,7 +973,7 @@ mod test {
assert_eq!(db.last_insert_rowid(), 1); assert_eq!(db.last_insert_rowid(), 1);
let mut stmt = db.prepare("INSERT INTO foo DEFAULT VALUES").unwrap(); let mut stmt = db.prepare("INSERT INTO foo DEFAULT VALUES").unwrap();
for _ in range(0i32, 9) { for _ in 0i32 .. 9 {
stmt.execute(&[]).unwrap(); stmt.execute(&[]).unwrap();
} }
assert_eq!(db.last_insert_rowid(), 10); assert_eq!(db.last_insert_rowid(), 10);

View File

@ -240,7 +240,7 @@ mod test {
let mut stmt = db.prepare("INSERT INTO foo VALUES(1)").unwrap(); let mut stmt = db.prepare("INSERT INTO foo VALUES(1)").unwrap();
bencher.iter(|| { bencher.iter(|| {
for _ in range(0i32, 1000) { for _ in 0i32 .. 1000 {
stmt.execute(&[]).unwrap(); stmt.execute(&[]).unwrap();
} }
}) })
@ -255,7 +255,7 @@ mod test {
bencher.iter(|| { bencher.iter(|| {
let mut tx = db.transaction().unwrap(); let mut tx = db.transaction().unwrap();
tx.set_commit(); tx.set_commit();
for _ in range(0i32, 1000) { for _ in 0i32 .. 1000 {
stmt.execute(&[]).unwrap(); stmt.execute(&[]).unwrap();
} }
}) })

View File

@ -101,7 +101,7 @@ impl<'a> ToSql for &'a str {
impl ToSql for String { impl ToSql for String {
unsafe fn bind_parameter(&self, stmt: *mut sqlite3_stmt, col: c_int) -> c_int { unsafe fn bind_parameter(&self, stmt: *mut sqlite3_stmt, col: c_int) -> c_int {
self.as_slice().bind_parameter(stmt, col) (&self[..]).bind_parameter(stmt, col)
} }
} }
@ -115,7 +115,7 @@ impl<'a> ToSql for &'a [u8] {
impl ToSql for Vec<u8> { impl ToSql for Vec<u8> {
unsafe fn bind_parameter(&self, stmt: *mut sqlite3_stmt, col: c_int) -> c_int { unsafe fn bind_parameter(&self, stmt: *mut sqlite3_stmt, col: c_int) -> c_int {
self.as_slice().bind_parameter(stmt, col) (&self[..]).bind_parameter(stmt, col)
} }
} }
@ -207,7 +207,7 @@ impl FromSql for time::Timespec {
col: c_int) -> SqliteResult<time::Timespec> { col: c_int) -> SqliteResult<time::Timespec> {
let col_str = FromSql::column_result(stmt, col); let col_str = FromSql::column_result(stmt, col);
col_str.and_then(|txt: String| { col_str.and_then(|txt: String| {
time::strptime(txt.as_slice(), SQLITE_DATETIME_FMT).map(|tm| { time::strptime(&txt, SQLITE_DATETIME_FMT).map(|tm| {
tm.to_timespec() tm.to_timespec()
}).map_err(|parse_error| { }).map_err(|parse_error| {
SqliteError{ code: ffi::SQLITE_MISMATCH, message: format!("{}", parse_error) } SqliteError{ code: ffi::SQLITE_MISMATCH, message: format!("{}", parse_error) }
@ -256,7 +256,7 @@ mod test {
db.execute("INSERT INTO foo(t) VALUES (?)", &[&s.to_string()]).unwrap(); db.execute("INSERT INTO foo(t) VALUES (?)", &[&s.to_string()]).unwrap();
let from: String = db.query_row("SELECT t FROM foo", &[], |r| r.get(0)); let from: String = db.query_row("SELECT t FROM foo", &[], |r| r.get(0));
assert_eq!(from.as_slice(), s); assert_eq!(from, s);
} }
#[test] #[test]
@ -286,7 +286,7 @@ mod test {
let row1 = rows.next().unwrap().unwrap(); let row1 = rows.next().unwrap().unwrap();
let s1: Option<String> = row1.get(0); let s1: Option<String> = row1.get(0);
let b1: Option<Vec<u8>> = row1.get(1); let b1: Option<Vec<u8>> = row1.get(1);
assert_eq!(s.unwrap(), s1.unwrap().as_slice()); assert_eq!(s.unwrap(), s1.unwrap());
assert!(b1.is_none()); assert!(b1.is_none());
let row2 = rows.next().unwrap().unwrap(); let row2 = rows.next().unwrap().unwrap();