mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 11:31:37 +08:00
Rustfmt
This commit is contained in:
parent
f04047db01
commit
1262238229
@ -63,12 +63,7 @@ impl Connection {
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
use self::StepResult::{Busy, Done, Locked, More};
|
use self::StepResult::{Busy, Done, Locked, More};
|
||||||
let mut dst = Connection::open(dst_path)?;
|
let mut dst = Connection::open(dst_path)?;
|
||||||
let backup = Backup::new_with_names(
|
let backup = Backup::new_with_names(self, name, &mut dst, DatabaseName::Main)?;
|
||||||
self,
|
|
||||||
name,
|
|
||||||
&mut dst,
|
|
||||||
DatabaseName::Main
|
|
||||||
)?;
|
|
||||||
|
|
||||||
let mut r = More;
|
let mut r = More;
|
||||||
while r == More {
|
while r == More {
|
||||||
@ -308,8 +303,8 @@ impl<'a, 'b> Drop for Backup<'a, 'b> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::Backup;
|
use super::Backup;
|
||||||
use std::time::Duration;
|
|
||||||
use crate::{Connection, DatabaseName, NO_PARAMS};
|
use crate::{Connection, DatabaseName, NO_PARAMS};
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_backup() {
|
fn test_backup() {
|
||||||
|
@ -262,8 +262,8 @@ impl ToSql for ZeroBlob {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use std::io::{BufRead, BufReader, BufWriter, Read, Seek, SeekFrom, Write};
|
|
||||||
use crate::{Connection, DatabaseName, Result};
|
use crate::{Connection, DatabaseName, Result};
|
||||||
|
use std::io::{BufRead, BufReader, BufWriter, Read, Seek, SeekFrom, Write};
|
||||||
|
|
||||||
fn db_with_test_blob() -> Result<(Connection, i64)> {
|
fn db_with_test_blob() -> Result<(Connection, i64)> {
|
||||||
let db = Connection::open_in_memory()?;
|
let db = Connection::open_in_memory()?;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
//! Prepared statements cache for faster execution.
|
//! Prepared statements cache for faster execution.
|
||||||
|
|
||||||
use lru_cache::LruCache;
|
|
||||||
use crate::raw_statement::RawStatement;
|
use crate::raw_statement::RawStatement;
|
||||||
|
use crate::{Connection, Result, Statement};
|
||||||
|
use lru_cache::LruCache;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use crate::{Connection, Result, Statement};
|
|
||||||
|
|
||||||
impl Connection {
|
impl Connection {
|
||||||
/// Prepare a SQL statement for execution, returning a previously prepared
|
/// Prepare a SQL statement for execution, returning a previously prepared
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
use crate::types::Type;
|
||||||
|
use crate::{errmsg_to_string, ffi};
|
||||||
use std::error;
|
use std::error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::os::raw::c_int;
|
use std::os::raw::c_int;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::str;
|
use std::str;
|
||||||
use crate::types::Type;
|
|
||||||
use crate::{errmsg_to_string, ffi};
|
|
||||||
|
|
||||||
/// Old name for `Error`. `SqliteError` is deprecated.
|
/// Old name for `Error`. `SqliteError` is deprecated.
|
||||||
#[deprecated(since = "0.6.0", note = "Use Error instead")]
|
#[deprecated(since = "0.6.0", note = "Use Error instead")]
|
||||||
|
@ -289,8 +289,8 @@ fn free_boxed_hook<F>(p: *mut c_void) {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::Action;
|
use super::Action;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
|
||||||
use crate::Connection;
|
use crate::Connection;
|
||||||
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_commit_hook() {
|
fn test_commit_hook() {
|
||||||
|
@ -1577,9 +1577,7 @@ mod test {
|
|||||||
for (i, v) in vals.iter().enumerate() {
|
for (i, v) in vals.iter().enumerate() {
|
||||||
let i_to_insert = i as i64;
|
let i_to_insert = i as i64;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
insert_stmt
|
insert_stmt.execute(&[&i_to_insert as &ToSql, &v]).unwrap(),
|
||||||
.execute(&[&i_to_insert as &ToSql, &v])
|
|
||||||
.unwrap(),
|
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use std::ops::Deref;
|
|
||||||
use crate::{Connection, Result};
|
use crate::{Connection, Result};
|
||||||
|
use std::ops::Deref;
|
||||||
|
|
||||||
/// Old name for `TransactionBehavior`. `SqliteTransactionBehavior` is
|
/// Old name for `TransactionBehavior`. `SqliteTransactionBehavior` is
|
||||||
/// deprecated.
|
/// deprecated.
|
||||||
|
@ -114,9 +114,9 @@ mod test {
|
|||||||
extern crate time;
|
extern crate time;
|
||||||
|
|
||||||
use super::Value;
|
use super::Value;
|
||||||
|
use crate::{Connection, Error, NO_PARAMS};
|
||||||
use std::f64::EPSILON;
|
use std::f64::EPSILON;
|
||||||
use std::os::raw::{c_double, c_int};
|
use std::os::raw::{c_double, c_int};
|
||||||
use crate::{Connection, Error, NO_PARAMS};
|
|
||||||
|
|
||||||
fn checked_memory_handle() -> Connection {
|
fn checked_memory_handle() -> Connection {
|
||||||
let db = Connection::open_in_memory().unwrap();
|
let db = Connection::open_in_memory().unwrap();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use super::{Null, Value, ValueRef};
|
use super::{Null, Value, ValueRef};
|
||||||
use std::borrow::Cow;
|
|
||||||
#[cfg(feature = "array")]
|
#[cfg(feature = "array")]
|
||||||
use crate::vtab::array::Array;
|
use crate::vtab::array::Array;
|
||||||
use crate::Result;
|
use crate::Result;
|
||||||
|
use std::borrow::Cow;
|
||||||
|
|
||||||
/// `ToSqlOutput` represents the possible output types for implementors of the
|
/// `ToSqlOutput` represents the possible output types for implementors of the
|
||||||
/// `ToSql` trait.
|
/// `ToSql` trait.
|
||||||
@ -207,8 +207,8 @@ mod test {
|
|||||||
#[cfg(feature = "i128_blob")]
|
#[cfg(feature = "i128_blob")]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_i128() {
|
fn test_i128() {
|
||||||
use std::i128;
|
|
||||||
use crate::{Connection, NO_PARAMS};
|
use crate::{Connection, NO_PARAMS};
|
||||||
|
use std::i128;
|
||||||
let db = Connection::open_in_memory().unwrap();
|
let db = Connection::open_in_memory().unwrap();
|
||||||
db.execute_batch("CREATE TABLE foo (i128 BLOB, desc TEXT)")
|
db.execute_batch("CREATE TABLE foo (i128 BLOB, desc TEXT)")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -99,10 +99,10 @@ pub fn wait_for_unlock_notify(_db: *mut ffi::sqlite3) -> c_int {
|
|||||||
#[cfg(feature = "unlock_notify")]
|
#[cfg(feature = "unlock_notify")]
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
use crate::{Connection, OpenFlags, Result, Transaction, TransactionBehavior, NO_PARAMS};
|
||||||
use std::sync::mpsc::sync_channel;
|
use std::sync::mpsc::sync_channel;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time;
|
use std::time;
|
||||||
use crate::{Connection, OpenFlags, Result, Transaction, TransactionBehavior, NO_PARAMS};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_unlock_notify() {
|
fn test_unlock_notify() {
|
||||||
|
@ -169,10 +169,10 @@ impl VTabCursor for ArrayTabCursor {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use std::rc::Rc;
|
|
||||||
use crate::types::Value;
|
use crate::types::Value;
|
||||||
use crate::vtab::array;
|
use crate::vtab::array;
|
||||||
use crate::Connection;
|
use crate::Connection;
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_array_module() {
|
fn test_array_module() {
|
||||||
|
Loading…
Reference in New Issue
Block a user