Lifetime elision in impl

This commit is contained in:
gwenn
2019-02-03 11:02:38 +01:00
parent 2f965fec5a
commit e9896a7734
13 changed files with 60 additions and 57 deletions

View File

@@ -40,7 +40,7 @@ where
// be converted into Values.
macro_rules! from_value(
($t:ty) => (
impl<'a> From<$t> for ToSqlOutput<'a> {
impl From<$t> for ToSqlOutput<'_> {
fn from(t: $t) -> Self { ToSqlOutput::Owned(t.into())}
}
)
@@ -65,7 +65,7 @@ from_value!(Vec<u8>);
#[cfg(feature = "i128_blob")]
from_value!(i128);
impl<'a> ToSql for ToSqlOutput<'a> {
impl ToSql for ToSqlOutput<'_> {
fn to_sql(&self) -> Result<ToSqlOutput<'_>> {
Ok(match *self {
ToSqlOutput::Borrowed(v) => ToSqlOutput::Borrowed(v),
@@ -121,7 +121,7 @@ to_sql_self!(f64);
#[cfg(feature = "i128_blob")]
to_sql_self!(i128);
impl<'a, T: ?Sized> ToSql for &'a T
impl<T: ?Sized> ToSql for &'_ T
where
T: ToSql,
{
@@ -169,7 +169,7 @@ impl<T: ToSql> ToSql for Option<T> {
}
}
impl<'a> ToSql for Cow<'a, str> {
impl ToSql for Cow<'_, str> {
fn to_sql(&self) -> Result<ToSqlOutput<'_>> {
Ok(ToSqlOutput::from(self.as_ref()))
}

View File

@@ -19,7 +19,7 @@ pub enum ValueRef<'a> {
Blob(&'a [u8]),
}
impl<'a> ValueRef<'a> {
impl ValueRef<'_> {
pub fn data_type(&self) -> Type {
match *self {
ValueRef::Null => Type::Null,
@@ -69,7 +69,7 @@ impl<'a> ValueRef<'a> {
}
}
impl<'a> From<ValueRef<'a>> for Value {
impl From<ValueRef<'_>> for Value {
fn from(borrowed: ValueRef<'_>) -> Value {
match borrowed {
ValueRef::Null => Value::Null,