diff --git a/diesel/src/expression/mod.rs b/diesel/src/expression/mod.rs index b2c026631be6..0f6fefc6f953 100644 --- a/diesel/src/expression/mod.rs +++ b/diesel/src/expression/mod.rs @@ -212,9 +212,9 @@ where T: Expression, ST: SqlType + TypedExpressionType, { - type Expression = Self; + type Expression = T; - fn as_expression(self) -> Self { + fn as_expression(self) -> T { self } } diff --git a/diesel/src/query_builder/mod.rs b/diesel/src/query_builder/mod.rs index 7cbad028dff2..77be2dcba067 100644 --- a/diesel/src/query_builder/mod.rs +++ b/diesel/src/query_builder/mod.rs @@ -333,10 +333,10 @@ pub trait AsQuery { } impl AsQuery for T { - type SqlType = ::SqlType; - type Query = Self; + type SqlType = ::SqlType; + type Query = T; - fn as_query(self) -> Self::Query { + fn as_query(self) -> ::Query { self } } diff --git a/diesel/src/query_dsl/load_dsl.rs b/diesel/src/query_dsl/load_dsl.rs index d03ffefe7575..843df18802ea 100644 --- a/diesel/src/query_dsl/load_dsl.rs +++ b/diesel/src/query_dsl/load_dsl.rs @@ -90,13 +90,15 @@ pub trait ExecuteDsl, DB: Backend = QueryResult; } +use crate::result::Error; + impl ExecuteDsl for T where Conn: Connection, DB: Backend, T: QueryFragment + QueryId, { - fn execute(query: Self, conn: &mut Conn) -> QueryResult { + fn execute(query: T, conn: &mut Conn) -> Result { conn.execute_returning_count(&query) } }