Skip to content

Commit 104550e

Browse files
committed
Merge branch 'Ten0-simpler_walk_ast' into cleanup/backend
2 parents 87f1bc3 + d305fd8 commit 104550e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+177
-512
lines changed

diesel/src/expression/array_comparison.rs

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ where
5555
DB: Backend,
5656
Self: QueryFragment<DB, DB::ArrayComparision>,
5757
{
58-
fn walk_ast<'a, 'b>(&'a self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>
59-
where
60-
'a: 'b,
61-
{
58+
fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()> {
6259
<Self as QueryFragment<DB, DB::ArrayComparision>>::walk_ast(self, pass)
6360
}
6461
}
@@ -71,10 +68,7 @@ where
7168
T: QueryFragment<DB>,
7269
U: QueryFragment<DB> + MaybeEmpty,
7370
{
74-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
75-
where
76-
'a: 'b,
77-
{
71+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
7872
if self.values.is_empty() {
7973
out.push_sql("1=0");
8074
} else {
@@ -92,10 +86,7 @@ where
9286
DB: Backend,
9387
Self: QueryFragment<DB, DB::ArrayComparision>,
9488
{
95-
fn walk_ast<'a, 'b>(&'a self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>
96-
where
97-
'a: 'b,
98-
{
89+
fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()> {
9990
<Self as QueryFragment<DB, DB::ArrayComparision>>::walk_ast(self, pass)
10091
}
10192
}
@@ -108,10 +99,7 @@ where
10899
T: QueryFragment<DB>,
109100
U: QueryFragment<DB> + MaybeEmpty,
110101
{
111-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
112-
where
113-
'a: 'b,
114-
{
102+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
115103
if self.values.is_empty() {
116104
out.push_sql("1=1");
117105
} else {
@@ -227,10 +215,7 @@ where
227215
Self: QueryFragment<DB, DB::ArrayComparision>,
228216
DB: Backend,
229217
{
230-
fn walk_ast<'a, 'b>(&'a self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>
231-
where
232-
'a: 'b,
233-
{
218+
fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()> {
234219
<Self as QueryFragment<DB, DB::ArrayComparision>>::walk_ast(self, pass)
235220
}
236221
}
@@ -244,10 +229,7 @@ where
244229
ST: SingleValue,
245230
I: ToSql<ST, DB>,
246231
{
247-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
248-
where
249-
'a: 'b,
250-
{
232+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
251233
out.unsafe_to_cache_prepared();
252234
let mut first = true;
253235
for value in &self.0 {

diesel/src/expression/assume_not_null.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ where
2929
DB: Backend,
3030
T: QueryFragment<DB>,
3131
{
32-
fn walk_ast<'a, 'b>(&'a self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>
33-
where
34-
'a: 'b,
35-
{
32+
fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()> {
3633
self.0.walk_ast(pass)
3734
}
3835
}

diesel/src/expression/bound.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ where
3434
DB: Backend + HasSqlType<T>,
3535
U: ToSql<T, DB>,
3636
{
37-
fn walk_ast<'a, 'b>(&'a self, mut pass: AstPass<'_, 'b, DB>) -> QueryResult<()>
38-
where
39-
'a: 'b,
40-
{
37+
fn walk_ast<'b>(&'b self, mut pass: AstPass<'_, 'b, DB>) -> QueryResult<()> {
4138
pass.push_bind_param(&self.item)?;
4239
Ok(())
4340
}

diesel/src/expression/coerce.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ where
6060
T: QueryFragment<DB>,
6161
DB: Backend,
6262
{
63-
fn walk_ast<'a, 'b>(&'a self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>
64-
where
65-
'a: 'b,
66-
{
63+
fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()> {
6764
self.expr.walk_ast(pass)
6865
}
6966
}

diesel/src/expression/count.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ impl Expression for CountStar {
6868
}
6969

7070
impl<DB: Backend> QueryFragment<DB> for CountStar {
71-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
72-
where
73-
'a: 'b,
74-
{
71+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
7572
out.push_sql("COUNT(*)");
7673
Ok(())
7774
}
@@ -152,10 +149,7 @@ where
152149
DB: Backend,
153150
E: QueryFragment<DB>,
154151
{
155-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
156-
where
157-
'a: 'b,
158-
{
152+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
159153
out.push_sql("COUNT(DISTINCT ");
160154
self.expr.walk_ast(out.reborrow())?;
161155
out.push_sql(")");

diesel/src/expression/exists.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ where
5555
DB: Backend,
5656
Self: QueryFragment<DB, DB::ExistsSyntax>,
5757
{
58-
fn walk_ast<'a, 'b>(&'a self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>
59-
where
60-
'a: 'b,
61-
{
58+
fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()> {
6259
<Self as QueryFragment<DB, DB::ExistsSyntax>>::walk_ast(self, pass)
6360
}
6461
}
@@ -68,10 +65,7 @@ where
6865
DB: Backend + SqlDialect<ExistsSyntax = sql_dialect::exists_syntax::AnsiSqlExistsSyntax>,
6966
T: QueryFragment<DB>,
7067
{
71-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
72-
where
73-
'a: 'b,
74-
{
68+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
7569
out.push_sql("EXISTS (");
7670
self.0.walk_ast(out.reborrow())?;
7771
out.push_sql(")");

diesel/src/expression/functions/date_and_time.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ impl Expression for now {
1717
}
1818

1919
impl<DB: Backend> QueryFragment<DB> for now {
20-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
21-
where
22-
'a: 'b,
23-
{
20+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
2421
out.push_sql("CURRENT_TIMESTAMP");
2522
Ok(())
2623
}
@@ -85,10 +82,7 @@ impl Expression for today {
8582
}
8683

8784
impl<DB: Backend> QueryFragment<DB> for today {
88-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
89-
where
90-
'a: 'b,
91-
{
85+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
9286
out.push_sql("CURRENT_DATE");
9387
Ok(())
9488
}

diesel/src/expression/functions/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ macro_rules! no_arg_sql_function_body {
3535
impl<DB> $crate::query_builder::QueryFragment<DB> for $type_name where
3636
DB: $crate::backend::Backend + $($constraint)::+,
3737
{
38-
fn walk_ast<'a: 'b, 'b>(&'a self, mut out: $crate::query_builder::AstPass<'_, 'b, DB>)
39-
-> $crate::result::QueryResult<()>
38+
fn walk_ast<'b>(&'b self, mut out: $crate::query_builder::AstPass<'_, 'b, DB>) -> $crate::result::QueryResult<()>
4039
{
4140
out.push_sql(concat!(stringify!($type_name), "()"));
4241
Ok(())
@@ -50,7 +49,7 @@ macro_rules! no_arg_sql_function_body {
5049
impl<DB> $crate::query_builder::QueryFragment<DB> for $type_name where
5150
DB: $crate::backend::Backend,
5251
{
53-
fn walk_ast<'a: 'b, 'b>(&'a self, mut out: $crate::query_builder::AstPass<'_, 'b, DB>) -> $crate::result::QueryResult<()> {
52+
fn walk_ast<'b>(&'b self, mut out: $crate::query_builder::AstPass<'_, 'b, DB>) -> $crate::result::QueryResult<()> {
5453
out.push_sql(concat!(stringify!($type_name), "()"));
5554
Ok(())
5655
}

diesel/src/expression/grouped.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ impl<T: Expression> Expression for Grouped<T> {
1212
}
1313

1414
impl<T: QueryFragment<DB>, DB: Backend> QueryFragment<DB> for Grouped<T> {
15-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
16-
where
17-
'a: 'b,
18-
{
15+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
1916
out.push_sql("(");
2017
self.0.walk_ast(out.reborrow())?;
2118
out.push_sql(")");

diesel/src/expression/nullable.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ where
2929
DB: Backend,
3030
T: QueryFragment<DB>,
3131
{
32-
fn walk_ast<'a, 'b>(&'a self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>
33-
where
34-
'a: 'b,
35-
{
32+
fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()> {
3633
self.0.walk_ast(pass)
3734
}
3835
}

diesel/src/expression/operators.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,10 @@ macro_rules! __diesel_operator_body {
9393
$($ty_param: $crate::query_builder::QueryFragment<$backend_ty>,)+
9494
$($backend_ty_param: $crate::backend::Backend,)*
9595
{
96-
fn walk_ast<'a, 'b>(
97-
&'a self,
96+
fn walk_ast<'b>(
97+
&'b self,
9898
mut out: $crate::query_builder::AstPass<'_, 'b, $backend_ty>
9999
) -> $crate::result::QueryResult<()>
100-
where 'a: 'b
101100
{
102101
$crate::__diesel_operator_to_sql!(
103102
notation = $notation,
@@ -590,13 +589,10 @@ where
590589
R: QueryFragment<DB>,
591590
DB: Backend,
592591
{
593-
fn walk_ast<'a, 'b>(
594-
&'a self,
592+
fn walk_ast<'b>(
593+
&'b self,
595594
mut out: crate::query_builder::AstPass<'_, 'b, DB>,
596-
) -> crate::result::QueryResult<()>
597-
where
598-
'a: 'b,
599-
{
595+
) -> crate::result::QueryResult<()> {
600596
// Those brackets are required because mysql is broken
601597
// https://github.com/diesel-rs/diesel/issues/2133#issuecomment-517432317
602598
out.push_sql("(");

diesel/src/expression/ops/numeric.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ macro_rules! numeric_operation {
3737
Lhs: QueryFragment<DB>,
3838
Rhs: QueryFragment<DB>,
3939
{
40-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
41-
where 'a: 'b
40+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
4241
{
4342
out.push_sql("(");
4443
self.lhs.walk_ast(out.reborrow())?;

diesel/src/expression/select_by.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ where
102102
T::SelectExpression: QueryFragment<DB>,
103103
DB: Backend,
104104
{
105-
fn walk_ast<'a, 'b>(&'a self, out: AstPass<'_, 'b, DB>) -> QueryResult<()>
106-
where
107-
'a: 'b,
108-
{
105+
fn walk_ast<'b>(&'b self, out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
109106
self.selection.walk_ast(out)
110107
}
111108
}

diesel/src/expression/sql_literal.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,7 @@ where
168168
DB: Backend,
169169
T: QueryFragment<DB>,
170170
{
171-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
172-
where
173-
'a: 'b,
174-
{
171+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
175172
out.unsafe_to_cache_prepared();
176173
self.inner.walk_ast(out.reborrow())?;
177174
out.push_sql(&self.sql);
@@ -348,10 +345,7 @@ where
348345
Query: QueryFragment<DB>,
349346
Value: QueryFragment<DB>,
350347
{
351-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
352-
where
353-
'a: 'b,
354-
{
348+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
355349
self.query.walk_ast(out.reborrow())?;
356350
self.value.walk_ast(out.reborrow())?;
357351
Ok(())

diesel/src/expression/subselect.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ where
6060
DB: Backend,
6161
T: QueryFragment<DB>,
6262
{
63-
fn walk_ast<'a, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()>
64-
where
65-
'a: 'b,
66-
{
63+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
6764
self.values.walk_ast(out.reborrow())?;
6865
Ok(())
6966
}

diesel/src/insertable.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ where
185185
DB: Backend,
186186
Self: QueryFragment<DB, DB::InsertWithDefaultKeyword>,
187187
{
188-
fn walk_ast<'a: 'b, 'b>(&'a self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()> {
188+
fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()> {
189189
<Self as QueryFragment<DB, DB::InsertWithDefaultKeyword>>::walk_ast(self, pass)
190190
}
191191
}
@@ -195,7 +195,7 @@ where
195195
DB: Backend + SqlDialect<InsertWithDefaultKeyword = sql_dialect::default_keyword_for_insert::IsoSqlDefaultKeyword>,
196196
Expr: QueryFragment<DB>,
197197
{
198-
fn walk_ast<'a: 'b, 'b>(&'a self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
198+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, DB>) -> QueryResult<()> {
199199
out.unsafe_to_cache_prepared();
200200
if let Self::Expression(ref inner) = *self {
201201
inner.walk_ast(out.reborrow())?;
@@ -211,7 +211,7 @@ where
211211
DB: Backend,
212212
Expr: QueryFragment<DB>,
213213
{
214-
fn walk_ast<'a: 'b, 'b>(&'a self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()> {
214+
fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()> {
215215
self.expr.walk_ast(pass)
216216
}
217217
}
@@ -241,10 +241,7 @@ impl<Col, Expr>
241241
where
242242
Expr: QueryFragment<crate::sqlite::Sqlite>,
243243
{
244-
fn walk_ast<'a: 'b, 'b>(
245-
&'a self,
246-
mut out: AstPass<'_, 'b, crate::sqlite::Sqlite>,
247-
) -> QueryResult<()> {
244+
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, crate::sqlite::Sqlite>) -> QueryResult<()> {
248245
if let Self::Expression(ref inner) = *self {
249246
inner.walk_ast(out.reborrow())?;
250247
}

diesel/src/macros/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ macro_rules! __diesel_column {
7171
<$table as $crate::QuerySource>::FromClause: $crate::query_builder::QueryFragment<DB>,
7272
{
7373
#[allow(non_snake_case)]
74-
fn walk_ast<'a, 'b>(&'a self, mut __out: $crate::query_builder::AstPass<'_, 'b, DB>) -> $crate::result::QueryResult<()>
75-
where 'a: 'b
74+
fn walk_ast<'b>(&'b self, mut __out: $crate::query_builder::AstPass<'_, 'b, DB>) -> $crate::result::QueryResult<()>
7675
{
7776
use $crate::QuerySource;
7877
const FROM_CLAUSE: $crate::query_builder::nodes::StaticQueryFragmentInstance<table> = $crate::query_builder::nodes::StaticQueryFragmentInstance::new();
@@ -886,8 +885,7 @@ macro_rules! __diesel_table_impl {
886885
<table as $crate::QuerySource>::FromClause: $crate::query_builder::QueryFragment<DB>,
887886
{
888887
#[allow(non_snake_case)]
889-
fn walk_ast<'a, 'b>(&'a self, mut __out: $crate::query_builder::AstPass<'_, 'b, DB>) -> $crate::result::QueryResult<()>
890-
where 'a: 'b
888+
fn walk_ast<'b>(&'b self, mut __out: $crate::query_builder::AstPass<'_, 'b, DB>) -> $crate::result::QueryResult<()>
891889
{
892890
use $crate::QuerySource;
893891
const FROM_CLAUSE: $crate::query_builder::nodes::StaticQueryFragmentInstance<table> = $crate::query_builder::nodes::StaticQueryFragmentInstance::new();

0 commit comments

Comments
 (0)