Rust 2018 idioms

This commit is contained in:
gwenn
2018-12-07 21:57:04 +01:00
parent 92020d54b7
commit d874180333
27 changed files with 142 additions and 146 deletions

View File

@@ -19,7 +19,7 @@ pub enum Error {
/// Error when the value of a particular column is requested, but it cannot
/// be converted to the requested Rust type.
FromSqlConversionFailure(usize, Type, Box<error::Error + Send + Sync>),
FromSqlConversionFailure(usize, Type, Box<dyn error::Error + Send + Sync>),
/// Error when SQLite gives us an integral value outside the range of the
/// requested type (e.g., trying to get the value 1000 into a `u8`).
@@ -78,10 +78,10 @@ pub enum Error {
/// `create_scalar_function`).
#[cfg(feature = "functions")]
#[allow(dead_code)]
UserFunctionError(Box<error::Error + Send + Sync>),
UserFunctionError(Box<dyn error::Error + Send + Sync>),
/// Error available for the implementors of the `ToSql` trait.
ToSqlConversionFailure(Box<error::Error + Send + Sync>),
ToSqlConversionFailure(Box<dyn error::Error + Send + Sync>),
/// Error when the SQL is not a `SELECT`, is not read-only.
InvalidQuery,
@@ -106,7 +106,7 @@ impl From<::std::ffi::NulError> for Error {
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
Error::SqliteFailure(ref err, None) => err.fmt(f),
Error::SqliteFailure(_, Some(ref s)) => write!(f, "{}", s),
@@ -191,7 +191,7 @@ impl error::Error for Error {
}
}
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
Error::SqliteFailure(ref err, _) => Some(err),
Error::Utf8Error(ref err) => Some(err),