upgrade to 2018 Rust edition

This is mostly just "cargo fix --edition" + Cargo.toml changes.
There's one fix for upgrading to NLL in db/writer.rs:
Writer::previously_opened wouldn't build with NLL because of a
double-borrow the previous borrow checker somehow didn't catch.
Restructure to avoid it.

I'll put elective NLL changes in a following commit.
This commit is contained in:
Scott Lamb
2018-12-28 12:21:49 -06:00
parent ff58f24785
commit 699ec87968
34 changed files with 134 additions and 129 deletions

View File

@@ -32,7 +32,7 @@
///
/// See `guide/schema.md` for more information.
use db;
use crate::db;
use failure::Error;
use rusqlite::{self, types::ToSql};

View File

@@ -30,9 +30,9 @@
/// Upgrades a version 0 schema to a version 1 schema.
use db;
use crate::db;
use failure::Error;
use recording;
use crate::recording;
use rusqlite::{self, types::ToSql};
use std::collections::HashMap;

View File

@@ -30,11 +30,11 @@
/// Upgrades a version 1 schema to a version 2 schema.
use dir;
use crate::dir;
use failure::Error;
use libc;
use rusqlite::{self, types::ToSql};
use schema::DirMeta;
use crate::schema::DirMeta;
use std::fs;
use std::os::unix::ffi::OsStrExt;
use uuid::Uuid;
@@ -332,7 +332,7 @@ fn verify_dir_contents(sample_file_path: &str, tx: &rusqlite::Transaction) -> Re
let mut rows = stmt.query(&[] as &[&ToSql])?;
while let Some(row) = rows.next() {
let row = row?;
let uuid: ::db::FromSqlUuid = row.get_checked(0)?;
let uuid: crate::db::FromSqlUuid = row.get_checked(0)?;
if !files.remove(&uuid.0) {
bail!("{} is missing from dir {}!", uuid.0, sample_file_path);
}
@@ -343,7 +343,7 @@ fn verify_dir_contents(sample_file_path: &str, tx: &rusqlite::Transaction) -> Re
let mut rows = stmt.query(&[] as &[&ToSql])?;
while let Some(row) = rows.next() {
let row = row?;
let uuid: ::db::FromSqlUuid = row.get_checked(0)?;
let uuid: crate::db::FromSqlUuid = row.get_checked(0)?;
files.remove(&uuid.0);
}

View File

@@ -32,11 +32,11 @@
/// Note that a version 2 schema is never actually used; so we know the upgrade from version 1 was
/// completed, and possibly an upgrade from 2 to 3 is half-finished.
use db::{self, FromSqlUuid};
use dir;
use crate::db::{self, FromSqlUuid};
use crate::dir;
use failure::Error;
use libc;
use schema;
use crate::schema;
use std::io::{self, Write};
use std::mem;
use std::sync::Arc;