mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
Remove most uses of #[feature(core)]
This commit is contained in:
parent
b3d949b3bb
commit
632d87de2f
14
src/lib.rs
14
src/lib.rs
@ -109,7 +109,7 @@ impl fmt::Display for SqliteError {
|
||||
|
||||
impl error::Error for SqliteError {
|
||||
fn description(&self) -> &str {
|
||||
self.message.as_slice()
|
||||
&self.message
|
||||
}
|
||||
}
|
||||
|
||||
@ -900,13 +900,13 @@ mod test {
|
||||
let rows = query.query(&[&4i32]).unwrap();
|
||||
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 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();
|
||||
|
||||
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", &[], |_| ());
|
||||
|
||||
@ -943,7 +943,7 @@ mod test {
|
||||
db.execute_batch("CREATE TABLE foo(x INTEGER);").unwrap();
|
||||
|
||||
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]
|
||||
@ -961,7 +961,7 @@ mod test {
|
||||
assert_eq!(2i32, second.get(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]
|
||||
@ -973,7 +973,7 @@ mod test {
|
||||
assert_eq!(db.last_insert_rowid(), 1);
|
||||
|
||||
let mut stmt = db.prepare("INSERT INTO foo DEFAULT VALUES").unwrap();
|
||||
for _ in range(0i32, 9) {
|
||||
for _ in 0i32 .. 9 {
|
||||
stmt.execute(&[]).unwrap();
|
||||
}
|
||||
assert_eq!(db.last_insert_rowid(), 10);
|
||||
|
@ -240,7 +240,7 @@ mod test {
|
||||
let mut stmt = db.prepare("INSERT INTO foo VALUES(1)").unwrap();
|
||||
|
||||
bencher.iter(|| {
|
||||
for _ in range(0i32, 1000) {
|
||||
for _ in 0i32 .. 1000 {
|
||||
stmt.execute(&[]).unwrap();
|
||||
}
|
||||
})
|
||||
@ -255,7 +255,7 @@ mod test {
|
||||
bencher.iter(|| {
|
||||
let mut tx = db.transaction().unwrap();
|
||||
tx.set_commit();
|
||||
for _ in range(0i32, 1000) {
|
||||
for _ in 0i32 .. 1000 {
|
||||
stmt.execute(&[]).unwrap();
|
||||
}
|
||||
})
|
||||
|
10
src/types.rs
10
src/types.rs
@ -101,7 +101,7 @@ impl<'a> ToSql for &'a str {
|
||||
|
||||
impl ToSql for String {
|
||||
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> {
|
||||
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> {
|
||||
let col_str = FromSql::column_result(stmt, col);
|
||||
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()
|
||||
}).map_err(|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();
|
||||
|
||||
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]
|
||||
@ -286,7 +286,7 @@ mod test {
|
||||
let row1 = rows.next().unwrap().unwrap();
|
||||
let s1: Option<String> = row1.get(0);
|
||||
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());
|
||||
|
||||
let row2 = rows.next().unwrap().unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user