cargo fix --all

* it added "dyn" to trait objects
* it changed "..." in patterns to "..="

cargo --version says: "cargo 1.37.0-nightly (545f35425 2019-05-23)"
This commit is contained in:
Scott Lamb
2019-06-14 08:47:11 -07:00
parent 7dd98bb76a
commit 7fe9d34655
22 changed files with 83 additions and 83 deletions

View File

@@ -346,7 +346,7 @@ impl State {
from
user
"#)?;
let mut rows = stmt.query(&[] as &[&ToSql])?;
let mut rows = stmt.query(&[] as &[&dyn ToSql])?;
while let Some(row) = rows.next()? {
let id = row.get(0)?;
let name: String = row.get(1)?;
@@ -596,7 +596,7 @@ impl State {
let addr = req.addr_buf();
let addr: Option<&[u8]> = addr.as_ref().map(|a| a.as_ref());
stmt.execute(&[
&req.when_sec as &ToSql,
&req.when_sec as &dyn ToSql,
&req.user_agent,
&addr,
&(reason as i32),

View File

@@ -58,7 +58,7 @@ pub fn run(conn: &rusqlite::Connection, opts: &Options) -> Result<(), Error> {
"#)?;
let mut garbage_stmt = conn.prepare_cached(
"select composite_id from garbage where sample_file_dir_id = ?")?;
let mut rows = dir_stmt.query(&[] as &[&ToSql])?;
let mut rows = dir_stmt.query(&[] as &[&dyn ToSql])?;
while let Some(row) = rows.next()? {
let mut meta = schema::DirMeta::default();
let dir_id: i32 = row.get(0)?;
@@ -92,7 +92,7 @@ pub fn run(conn: &rusqlite::Connection, opts: &Options) -> Result<(), Error> {
let mut stmt = conn.prepare(r#"
select id, sample_file_dir_id from stream where sample_file_dir_id is not null
"#)?;
let mut rows = stmt.query(&[] as &[&ToSql])?;
let mut rows = stmt.query(&[] as &[&dyn ToSql])?;
while let Some(row) = rows.next()? {
let stream_id = row.get(0)?;
let dir_id = row.get(1)?;

View File

@@ -446,7 +446,7 @@ pub struct Stream {
/// The number of recordings in `uncommitted` which are synced and ready to commit.
synced_recordings: usize,
on_live_segment: Vec<Box<FnMut(LiveSegment) -> bool + Send>>,
on_live_segment: Vec<Box<dyn FnMut(LiveSegment) -> bool + Send>>,
}
/// Bounds of a single keyframe and the frames dependent on it.
@@ -620,7 +620,7 @@ pub struct LockedDatabase {
cameras_by_uuid: BTreeMap<Uuid, i32>, // values are ids.
video_sample_entries_by_id: BTreeMap<i32, Arc<VideoSampleEntry>>,
video_index_cache: RefCell<LruCache<i64, Box<[u8]>, fnv::FnvBuildHasher>>,
on_flush: Vec<Box<Fn() + Send>>,
on_flush: Vec<Box<dyn Fn() + Send>>,
}
/// Represents a row of the `open` database table.
@@ -867,7 +867,7 @@ impl LockedDatabase {
/// Registers a callback to run on every live segment immediately after it's recorded.
/// The callback is run with the database lock held, so it must not call back into the database
/// or block. The callback should return false to unregister.
pub fn watch_live(&mut self, stream_id: i32, cb: Box<FnMut(LiveSegment) -> bool + Send>)
pub fn watch_live(&mut self, stream_id: i32, cb: Box<dyn FnMut(LiveSegment) -> bool + Send>)
-> Result<(), Error> {
let s = match self.streams_by_id.get_mut(&stream_id) {
None => bail!("no such stream {}", stream_id),
@@ -958,7 +958,7 @@ impl LockedDatabase {
let mut stmt = tx.prepare_cached(
r"update open set duration_90k = ?, end_time_90k = ? where id = ?")?;
let rows = stmt.execute(&[
&(recording::Time::new(clocks.monotonic()) - self.open_monotonic).0 as &ToSql,
&(recording::Time::new(clocks.monotonic()) - self.open_monotonic).0 as &dyn ToSql,
&recording::Time::new(clocks.realtime()).0,
&o.id,
])?;
@@ -1024,7 +1024,7 @@ impl LockedDatabase {
/// Sets a watcher which will receive an (empty) event on successful flush.
/// The lock will be held while this is run, so it should not do any I/O.
pub(crate) fn on_flush(&mut self, run: Box<Fn() + Send>) {
pub(crate) fn on_flush(&mut self, run: Box<dyn Fn() + Send>) {
self.on_flush.push(run);
}
@@ -1084,7 +1084,7 @@ impl LockedDatabase {
update sample_file_dir set last_complete_open_id = ? where id = ?
"#)?;
for &id in in_progress.keys() {
if stmt.execute(&[&o.id as &ToSql, &id])? != 1 {
if stmt.execute(&[&o.id as &dyn ToSql, &id])? != 1 {
bail!("unable to update dir {}", id);
}
}
@@ -1124,7 +1124,7 @@ impl LockedDatabase {
/// Uncommitted recordings are returned id order after the others.
pub fn list_recordings_by_time(
&self, stream_id: i32, desired_time: Range<recording::Time>,
f: &mut FnMut(ListRecordingsRow) -> Result<(), Error>) -> Result<(), Error> {
f: &mut dyn FnMut(ListRecordingsRow) -> Result<(), Error>) -> Result<(), Error> {
let s = match self.streams_by_id.get(&stream_id) {
None => bail!("no such stream {}", stream_id),
Some(s) => s,
@@ -1152,7 +1152,7 @@ impl LockedDatabase {
/// Lists the specified recordings in ascending order by id.
pub fn list_recordings_by_id(
&self, stream_id: i32, desired_ids: Range<i32>,
f: &mut FnMut(ListRecordingsRow) -> Result<(), Error>) -> Result<(), Error> {
f: &mut dyn FnMut(ListRecordingsRow) -> Result<(), Error>) -> Result<(), Error> {
let s = match self.streams_by_id.get(&stream_id) {
None => bail!("no such stream {}", stream_id),
Some(s) => s,
@@ -1186,7 +1186,7 @@ impl LockedDatabase {
pub fn list_aggregated_recordings(
&self, stream_id: i32, desired_time: Range<recording::Time>,
forced_split: recording::Duration,
f: &mut FnMut(&ListAggregatedRecordingsRow) -> Result<(), Error>)
f: &mut dyn FnMut(&ListAggregatedRecordingsRow) -> Result<(), Error>)
-> Result<(), Error> {
// Iterate, maintaining a map from a recording_id to the aggregated row for the latest
// batch of recordings from the run starting at that id. Runs can be split into multiple
@@ -1255,7 +1255,7 @@ impl LockedDatabase {
/// Note the lock is held for the duration of `f`.
/// This uses a LRU cache to reduce the number of retrievals from the database.
pub fn with_recording_playback<R>(&self, id: CompositeId,
f: &mut FnMut(&RecordingPlayback) -> Result<R, Error>)
f: &mut dyn FnMut(&RecordingPlayback) -> Result<R, Error>)
-> Result<R, Error> {
// Check for uncommitted path.
let s = self.streams_by_id
@@ -1292,7 +1292,7 @@ impl LockedDatabase {
/// Deletes the oldest recordings that aren't already queued for deletion.
/// `f` should return true for each row that should be deleted.
pub(crate) fn delete_oldest_recordings(
&mut self, stream_id: i32, f: &mut FnMut(&ListOldestRecordingsRow) -> bool)
&mut self, stream_id: i32, f: &mut dyn FnMut(&ListOldestRecordingsRow) -> bool)
-> Result<(), Error> {
let s = match self.streams_by_id.get_mut(&stream_id) {
None => bail!("no stream {}", stream_id),
@@ -1326,7 +1326,7 @@ impl LockedDatabase {
from
video_sample_entry
"#)?;
let mut rows = stmt.query(&[] as &[&ToSql])?;
let mut rows = stmt.query(&[] as &[&dyn ToSql])?;
while let Some(row) = rows.next()? {
let id = row.get(0)?;
let mut sha1 = [0u8; 20];
@@ -1365,7 +1365,7 @@ impl LockedDatabase {
from
sample_file_dir d left join open o on (d.last_complete_open_id = o.id);
"#)?;
let mut rows = stmt.query(&[] as &[&ToSql])?;
let mut rows = stmt.query(&[] as &[&dyn ToSql])?;
while let Some(row) = rows.next()? {
let id = row.get(0)?;
let dir_uuid: FromSqlUuid = row.get(2)?;
@@ -1406,7 +1406,7 @@ impl LockedDatabase {
from
camera;
"#)?;
let mut rows = stmt.query(&[] as &[&ToSql])?;
let mut rows = stmt.query(&[] as &[&dyn ToSql])?;
while let Some(row) = rows.next()? {
let id = row.get(0)?;
let uuid: FromSqlUuid = row.get(1)?;
@@ -1444,7 +1444,7 @@ impl LockedDatabase {
from
stream;
"#)?;
let mut rows = stmt.query(&[] as &[&ToSql])?;
let mut rows = stmt.query(&[] as &[&dyn ToSql])?;
while let Some(row) = rows.next()? {
let id = row.get(0)?;
let type_: String = row.get(1)?;
@@ -1549,7 +1549,7 @@ impl LockedDatabase {
self.conn.execute(r#"
insert into sample_file_dir (path, uuid, last_complete_open_id)
values (?, ?, ?)
"#, &[&path as &ToSql, &uuid_bytes, &o.id])?;
"#, &[&path as &dyn ToSql, &uuid_bytes, &o.id])?;
let id = self.conn.last_insert_rowid() as i32;
use ::std::collections::btree_map::Entry;
let e = self.sample_file_dirs_by_id.entry(id);
@@ -1796,7 +1796,7 @@ impl LockedDatabase {
self.signal.types_by_uuid()
}
pub fn list_changes_by_time(
&self, desired_time: Range<recording::Time>, f: &mut FnMut(&signal::ListStateChangesRow)) {
&self, desired_time: Range<recording::Time>, f: &mut dyn FnMut(&signal::ListStateChangesRow)) {
self.signal.list_changes_by_time(desired_time, f)
}
pub fn update_signals(
@@ -1810,7 +1810,7 @@ impl LockedDatabase {
/// Note this doesn't set journal options, so that it can be used on in-memory databases for
/// test code.
pub fn init(conn: &mut rusqlite::Connection) -> Result<(), Error> {
conn.execute("pragma foreign_keys = on", &[] as &[&ToSql])?;
conn.execute("pragma foreign_keys = on", &[] as &[&dyn ToSql])?;
let tx = conn.transaction()?;
tx.execute_batch(include_str!("schema.sql"))?;
{
@@ -1829,11 +1829,11 @@ pub fn init(conn: &mut rusqlite::Connection) -> Result<(), Error> {
pub fn get_schema_version(conn: &rusqlite::Connection) -> Result<Option<i32>, Error> {
let ver_tables: i32 = conn.query_row_and_then(
"select count(*) from sqlite_master where name = 'version'",
&[] as &[&ToSql], |row| row.get(0))?;
&[] as &[&dyn ToSql], |row| row.get(0))?;
if ver_tables == 0 {
return Ok(None);
}
Ok(Some(conn.query_row_and_then("select max(id) from version", &[] as &[&ToSql],
Ok(Some(conn.query_row_and_then("select max(id) from version", &[] as &[&dyn ToSql],
|row| row.get(0))?))
}
@@ -1871,7 +1871,7 @@ impl<C: Clocks + Clone> Database<C> {
/// Creates the database from a caller-supplied SQLite connection.
pub fn new(clocks: C, conn: rusqlite::Connection,
read_write: bool) -> Result<Database<C>, Error> {
conn.execute("pragma foreign_keys = on", &[] as &[&ToSql])?;
conn.execute("pragma foreign_keys = on", &[] as &[&dyn ToSql])?;
{
let ver = get_schema_version(&conn)?.ok_or_else(|| format_err!(
"no such table: version. \
@@ -1901,7 +1901,7 @@ impl<C: Clocks + Clone> Database<C> {
let mut stmt = conn.prepare(" insert into open (uuid, start_time_90k) values (?, ?)")?;
let uuid = Uuid::new_v4();
let uuid_bytes = &uuid.as_bytes()[..];
stmt.execute(&[&uuid_bytes as &ToSql, &real.0])?;
stmt.execute(&[&uuid_bytes as &dyn ToSql, &real.0])?;
Some(Open {
id: conn.last_insert_rowid() as u32,
uuid,

View File

@@ -302,8 +302,8 @@ pub(crate) fn parse_id(id: &[u8]) -> Result<CompositeId, ()> {
let mut v: u64 = 0;
for i in 0..16 {
v = (v << 4) | match id[i] {
b @ b'0'...b'9' => b - b'0',
b @ b'a'...b'f' => b - b'a' + 10,
b @ b'0'..=b'9' => b - b'0',
b @ b'a'..=b'f' => b - b'a' + 10,
_ => return Err(()),
} as u64;
}

View File

@@ -123,7 +123,7 @@ const LIST_OLDEST_RECORDINGS_SQL: &'static str = r#"
/// function. Given that the function is called with the database lock held, it should be quick.
pub(crate) fn list_recordings_by_time(
conn: &rusqlite::Connection, stream_id: i32, desired_time: Range<recording::Time>,
f: &mut FnMut(db::ListRecordingsRow) -> Result<(), Error>) -> Result<(), Error> {
f: &mut dyn FnMut(db::ListRecordingsRow) -> Result<(), Error>) -> Result<(), Error> {
let mut stmt = conn.prepare_cached(LIST_RECORDINGS_BY_TIME_SQL)?;
let rows = stmt.query_named(&[
(":stream_id", &stream_id),
@@ -135,7 +135,7 @@ pub(crate) fn list_recordings_by_time(
/// Lists the specified recordings in ascending order by id.
pub(crate) fn list_recordings_by_id(
conn: &rusqlite::Connection, stream_id: i32, desired_ids: Range<i32>,
f: &mut FnMut(db::ListRecordingsRow) -> Result<(), Error>) -> Result<(), Error> {
f: &mut dyn FnMut(db::ListRecordingsRow) -> Result<(), Error>) -> Result<(), Error> {
let mut stmt = conn.prepare_cached(LIST_RECORDINGS_BY_ID_SQL)?;
let rows = stmt.query_named(&[
(":start", &CompositeId::new(stream_id, desired_ids.start).0),
@@ -145,7 +145,7 @@ pub(crate) fn list_recordings_by_id(
}
fn list_recordings_inner(mut rows: rusqlite::Rows,
f: &mut FnMut(db::ListRecordingsRow) -> Result<(), Error>)
f: &mut dyn FnMut(db::ListRecordingsRow) -> Result<(), Error>)
-> Result<(), Error> {
while let Some(row) = rows.next()? {
f(db::ListRecordingsRow {
@@ -165,7 +165,7 @@ fn list_recordings_inner(mut rows: rusqlite::Rows,
}
pub(crate) fn get_db_uuid(conn: &rusqlite::Connection) -> Result<Uuid, Error> {
Ok(conn.query_row("select uuid from meta", &[] as &[&ToSql], |row| -> rusqlite::Result<Uuid> {
Ok(conn.query_row("select uuid from meta", &[] as &[&dyn ToSql], |row| -> rusqlite::Result<Uuid> {
let uuid: FromSqlUuid = row.get(0)?;
Ok(uuid.0)
})?)
@@ -266,7 +266,7 @@ pub(crate) fn delete_recordings(tx: &rusqlite::Transaction, sample_file_dir_id:
(":start", &ids.start.0),
(":end", &ids.end.0),
])?;
let p: &[(&str, &rusqlite::types::ToSql)] = &[
let p: &[(&str, &dyn rusqlite::types::ToSql)] = &[
(":start", &ids.start.0),
(":end", &ids.end.0),
];
@@ -360,7 +360,7 @@ pub(crate) fn list_garbage(conn: &rusqlite::Connection, dir_id: i32)
/// Lists the oldest recordings for a stream, starting with the given id.
/// `f` should return true as long as further rows are desired.
pub(crate) fn list_oldest_recordings(conn: &rusqlite::Connection, start: CompositeId,
f: &mut FnMut(db::ListOldestRecordingsRow) -> bool)
f: &mut dyn FnMut(db::ListOldestRecordingsRow) -> bool)
-> Result<(), Error> {
let mut stmt = conn.prepare_cached(LIST_OLDEST_RECORDINGS_SQL)?;
let mut rows = stmt.query_named(&[

View File

@@ -252,13 +252,13 @@ impl ::protobuf::Message for DirMeta {
&mut self.unknown_fields
}
fn as_any(&self) -> &::std::any::Any {
self as &::std::any::Any
fn as_any(&self) -> &dyn (::std::any::Any) {
self as &dyn (::std::any::Any)
}
fn as_any_mut(&mut self) -> &mut ::std::any::Any {
self as &mut ::std::any::Any
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}
@@ -462,13 +462,13 @@ impl ::protobuf::Message for DirMeta_Open {
&mut self.unknown_fields
}
fn as_any(&self) -> &::std::any::Any {
self as &::std::any::Any
fn as_any(&self) -> &dyn (::std::any::Any) {
self as &dyn (::std::any::Any)
}
fn as_any_mut(&mut self) -> &mut ::std::any::Any {
self as &mut ::std::any::Any
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}

View File

@@ -227,7 +227,7 @@ impl State {
}
pub fn list_changes_by_time(
&self, desired_time: Range<recording::Time>, f: &mut FnMut(&ListStateChangesRow)) {
&self, desired_time: Range<recording::Time>, f: &mut dyn FnMut(&ListStateChangesRow)) {
// First find the state immediately before. If it exists, include it.
if let Some((&when, p)) = self.points_by_time.range(..desired_time.start).next_back() {

View File

@@ -54,7 +54,7 @@ pub struct Args<'a> {
fn set_journal_mode(conn: &rusqlite::Connection, requested: &str) -> Result<(), Error> {
assert!(!requested.contains(';')); // quick check for accidental sql injection.
let actual = conn.query_row(&format!("pragma journal_mode = {}", requested), &[] as &[&ToSql],
let actual = conn.query_row(&format!("pragma journal_mode = {}", requested), &[] as &[&dyn ToSql],
|row| row.get::<_, String>(0))?;
info!("...database now in journal_mode {} (requested {}).", actual, requested);
Ok(())
@@ -71,7 +71,7 @@ pub fn run(args: &Args, conn: &mut rusqlite::Connection) -> Result<(), Error> {
{
assert_eq!(upgraders.len(), db::EXPECTED_VERSION as usize);
let old_ver =
conn.query_row("select max(id) from version", &[] as &[&ToSql],
conn.query_row("select max(id) from version", &[] as &[&dyn ToSql],
|row| row.get(0))?;
if old_ver > db::EXPECTED_VERSION {
bail!("Database is at version {}, later than expected {}",
@@ -88,7 +88,7 @@ pub fn run(args: &Args, conn: &mut rusqlite::Connection) -> Result<(), Error> {
tx.execute(r#"
insert into version (id, unix_time, notes)
values (?, cast(strftime('%s', 'now') as int32), ?)
"#, &[&(ver + 1) as &ToSql, &UPGRADE_NOTES])?;
"#, &[&(ver + 1) as &dyn ToSql, &UPGRADE_NOTES])?;
tx.commit()?;
}
}
@@ -97,7 +97,7 @@ pub fn run(args: &Args, conn: &mut rusqlite::Connection) -> Result<(), Error> {
// compiles the SQLite3 amalgamation with -DSQLITE_DEFAULT_FOREIGN_KEYS=1). Ensure it's
// always on. Note that our foreign keys are immediate rather than deferred, so we have to
// be careful about the order of operations during the upgrade.
conn.execute("pragma foreign_keys = on", &[] as &[&ToSql])?;
conn.execute("pragma foreign_keys = on", &[] as &[&dyn ToSql])?;
// WAL is the preferred journal mode for normal operation; it reduces the number of syncs
// without compromising safety.

View File

@@ -142,7 +142,7 @@ fn fill_recording(tx: &rusqlite::Transaction) -> Result<HashMap<i32, CameraState
insert into recording_playback values (:composite_id, :sample_file_uuid, :sample_file_sha1,
:video_index)
"#)?;
let mut rows = select.query(&[] as &[&ToSql])?;
let mut rows = select.query(&[] as &[&dyn ToSql])?;
let mut camera_state: HashMap<i32, CameraState> = HashMap::new();
while let Some(row) = rows.next()? {
let camera_id: i32 = row.get(0)?;
@@ -216,7 +216,7 @@ fn fill_camera(tx: &rusqlite::Transaction, camera_state: HashMap<i32, CameraStat
insert into camera values (:id, :uuid, :short_name, :description, :host, :username, :password,
:main_rtsp_path, :sub_rtsp_path, :retain_bytes, :next_recording_id)
"#)?;
let mut rows = select.query(&[] as &[&ToSql])?;
let mut rows = select.query(&[] as &[&dyn ToSql])?;
while let Some(row) = rows.next()? {
let id: i32 = row.get(0)?;
let uuid: Vec<u8> = row.get(1)?;

View File

@@ -122,7 +122,7 @@ pub fn run(args: &super::Args, tx: &rusqlite::Transaction) -> Result<(), Error>
tx.execute(r#"
insert into sample_file_dir (path, uuid, last_complete_open_id)
values (?, ?, ?)
"#, &[&sample_file_path as &ToSql, &dir_uuid_bytes, &open_id])?;
"#, &[&sample_file_path as &dyn ToSql, &dir_uuid_bytes, &open_id])?;
tx.execute_batch(r#"
drop table reserved_sample_files;
@@ -298,7 +298,7 @@ fn verify_dir_contents(sample_file_path: &str, tx: &rusqlite::Transaction) -> Re
from
(select count(*) as c from recording) a,
(select count(*) as c from reserved_sample_files) b;
"#, &[] as &[&ToSql], |r| r.get(0))?;
"#, &[] as &[&dyn ToSql], |r| r.get(0))?;
let mut files = ::fnv::FnvHashSet::with_capacity_and_hasher(n as usize, Default::default());
for e in fs::read_dir(sample_file_path)? {
let e = e?;
@@ -329,7 +329,7 @@ fn verify_dir_contents(sample_file_path: &str, tx: &rusqlite::Transaction) -> Re
// Iterate through the database and check that everything has a matching file.
{
let mut stmt = tx.prepare(r"select sample_file_uuid from recording_playback")?;
let mut rows = stmt.query(&[] as &[&ToSql])?;
let mut rows = stmt.query(&[] as &[&dyn ToSql])?;
while let Some(row) = rows.next()? {
let uuid: crate::db::FromSqlUuid = row.get(0)?;
if !files.remove(&uuid.0) {
@@ -339,7 +339,7 @@ fn verify_dir_contents(sample_file_path: &str, tx: &rusqlite::Transaction) -> Re
}
let mut stmt = tx.prepare(r"select uuid from reserved_sample_files")?;
let mut rows = stmt.query(&[] as &[&ToSql])?;
let mut rows = stmt.query(&[] as &[&dyn ToSql])?;
while let Some(row) = rows.next()? {
let uuid: crate::db::FromSqlUuid = row.get(0)?;
files.remove(&uuid.0);
@@ -366,7 +366,7 @@ fn fix_video_sample_entry(tx: &rusqlite::Transaction) -> Result<(), Error> {
let mut insert = tx.prepare(r#"
insert into video_sample_entry values (:id, :sha1, :width, :height, :rfc6381_codec, :data)
"#)?;
let mut rows = select.query(&[] as &[&ToSql])?;
let mut rows = select.query(&[] as &[&dyn ToSql])?;
while let Some(row) = rows.next()? {
let data: Vec<u8> = row.get(4)?;
insert.execute_named(&[

View File

@@ -57,7 +57,7 @@ fn open_sample_file_dir(tx: &rusqlite::Transaction) -> Result<Arc<dir::SampleFil
sample_file_dir s
join open o on (s.last_complete_open_id = o.id)
cross join meta m
"#, &[] as &[&ToSql], |row| {
"#, &[] as &[&dyn ToSql], |row| {
Ok((row.get(0)?,
row.get(1)?,
row.get(2)?,
@@ -84,7 +84,7 @@ pub fn run(_args: &super::Args, tx: &rusqlite::Transaction) -> Result<(), Error>
from
recording_playback
"#)?;
let mut rows = stmt.query(&[] as &[&ToSql])?;
let mut rows = stmt.query(&[] as &[&dyn ToSql])?;
while let Some(row) = rows.next()? {
let id = db::CompositeId(row.get(0)?);
let sample_file_uuid: FromSqlUuid = row.get(1)?;

View File

@@ -867,9 +867,9 @@ mod tests {
struct MockDir(Arc<Mutex<VecDeque<MockDirAction>>>);
enum MockDirAction {
Create(CompositeId, Box<Fn(CompositeId) -> Result<MockFile, io::Error> + Send>),
Sync(Box<Fn() -> Result<(), io::Error> + Send>),
Unlink(CompositeId, Box<Fn(CompositeId) -> Result<(), io::Error> + Send>),
Create(CompositeId, Box<dyn Fn(CompositeId) -> Result<MockFile, io::Error> + Send>),
Sync(Box<dyn Fn() -> Result<(), io::Error> + Send>),
Unlink(CompositeId, Box<dyn Fn(CompositeId) -> Result<(), io::Error> + Send>),
}
impl MockDir {
@@ -919,8 +919,8 @@ mod tests {
struct MockFile(Arc<Mutex<VecDeque<MockFileAction>>>);
enum MockFileAction {
SyncAll(Box<Fn() -> Result<(), io::Error> + Send>),
Write(Box<Fn(&[u8]) -> Result<usize, io::Error> + Send>),
SyncAll(Box<dyn Fn() -> Result<(), io::Error> + Send>),
Write(Box<dyn Fn(&[u8]) -> Result<usize, io::Error> + Send>),
}
impl MockFile {