@@ -59,7 +59,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
59
59
// clauses or bounds?
60
60
let predicates = self . tcx . predicates_defined_on ( def_id) . predicates ;
61
61
let where_clauses: Vec < _ > = predicates
62
- . into_iter ( )
62
+ . iter ( )
63
63
. map ( |( wc, _) | wc. subst ( self . tcx , & bound_vars) )
64
64
. filter_map ( |wc| LowerInto :: < Option < chalk_ir:: QuantifiedWhereClause < RustInterner < ' tcx > > > > :: lower_into ( wc, & self . interner ) ) . collect ( ) ;
65
65
@@ -88,7 +88,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
88
88
let binders = binders_for ( & self . interner , bound_vars) ;
89
89
let predicates = self . tcx . predicates_defined_on ( def_id) . predicates ;
90
90
let where_clauses: Vec < _ > = predicates
91
- . into_iter ( )
91
+ . iter ( )
92
92
. map ( |( wc, _) | wc. subst ( self . tcx , & bound_vars) )
93
93
. filter_map ( |wc| LowerInto :: < Option < chalk_ir:: QuantifiedWhereClause < RustInterner < ' tcx > > > > :: lower_into ( wc, & self . interner ) ) . collect ( ) ;
94
94
@@ -134,7 +134,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
134
134
135
135
let predicates = self . tcx . predicates_of ( adt_def_id) . predicates ;
136
136
let where_clauses: Vec < _ > = predicates
137
- . into_iter ( )
137
+ . iter ( )
138
138
. map ( |( wc, _) | wc. subst ( self . tcx , bound_vars) )
139
139
. filter_map ( |wc| LowerInto :: < Option < chalk_ir:: QuantifiedWhereClause < RustInterner < ' tcx > > > > :: lower_into ( wc, & self . interner ) )
140
140
. collect ( ) ;
@@ -166,46 +166,42 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
166
166
fundamental : adt_def. is_fundamental ( ) ,
167
167
} ,
168
168
} ) ;
169
- return struct_datum;
169
+ struct_datum
170
170
}
171
- RustDefId :: Ref ( _) => {
172
- return Arc :: new ( chalk_rust_ir:: StructDatum {
173
- id : struct_id,
174
- binders : chalk_ir:: Binders :: new (
175
- chalk_ir:: ParameterKinds :: from (
176
- & self . interner ,
177
- vec ! [
178
- chalk_ir:: ParameterKind :: Lifetime ( ( ) ) ,
179
- chalk_ir:: ParameterKind :: Ty ( ( ) ) ,
180
- ] ,
181
- ) ,
182
- chalk_rust_ir:: StructDatumBound { fields : vec ! [ ] , where_clauses : vec ! [ ] } ,
171
+ RustDefId :: Ref ( _) => Arc :: new ( chalk_rust_ir:: StructDatum {
172
+ id : struct_id,
173
+ binders : chalk_ir:: Binders :: new (
174
+ chalk_ir:: ParameterKinds :: from (
175
+ & self . interner ,
176
+ vec ! [
177
+ chalk_ir:: ParameterKind :: Lifetime ( ( ) ) ,
178
+ chalk_ir:: ParameterKind :: Ty ( ( ) ) ,
179
+ ] ,
183
180
) ,
184
- flags : chalk_rust_ir:: StructFlags { upstream : false , fundamental : false } ,
185
- } ) ;
186
- }
187
- RustDefId :: Array | RustDefId :: Slice => {
188
- return Arc :: new ( chalk_rust_ir:: StructDatum {
189
- id : struct_id,
190
- binders : chalk_ir:: Binders :: new (
191
- chalk_ir:: ParameterKinds :: from (
192
- & self . interner ,
193
- Some ( chalk_ir:: ParameterKind :: Ty ( ( ) ) ) ,
194
- ) ,
195
- chalk_rust_ir:: StructDatumBound { fields : vec ! [ ] , where_clauses : vec ! [ ] } ,
181
+ chalk_rust_ir:: StructDatumBound { fields : vec ! [ ] , where_clauses : vec ! [ ] } ,
182
+ ) ,
183
+ flags : chalk_rust_ir:: StructFlags { upstream : false , fundamental : false } ,
184
+ } ) ,
185
+ RustDefId :: Array | RustDefId :: Slice => Arc :: new ( chalk_rust_ir:: StructDatum {
186
+ id : struct_id,
187
+ binders : chalk_ir:: Binders :: new (
188
+ chalk_ir:: ParameterKinds :: from (
189
+ & self . interner ,
190
+ Some ( chalk_ir:: ParameterKind :: Ty ( ( ) ) ) ,
196
191
) ,
197
- flags : chalk_rust_ir:: StructFlags { upstream : false , fundamental : false } ,
198
- } ) ;
199
- }
192
+ chalk_rust_ir:: StructDatumBound { fields : vec ! [ ] , where_clauses : vec ! [ ] } ,
193
+ ) ,
194
+ flags : chalk_rust_ir:: StructFlags { upstream : false , fundamental : false } ,
195
+ } ) ,
200
196
RustDefId :: Str | RustDefId :: Never | RustDefId :: FnDef ( _) => {
201
- return Arc :: new ( chalk_rust_ir:: StructDatum {
197
+ Arc :: new ( chalk_rust_ir:: StructDatum {
202
198
id : struct_id,
203
199
binders : chalk_ir:: Binders :: new (
204
200
chalk_ir:: ParameterKinds :: new ( & self . interner ) ,
205
201
chalk_rust_ir:: StructDatumBound { fields : vec ! [ ] , where_clauses : vec ! [ ] } ,
206
202
) ,
207
203
flags : chalk_rust_ir:: StructFlags { upstream : false , fundamental : false } ,
208
- } ) ;
204
+ } )
209
205
}
210
206
211
207
_ => bug ! ( "Used not struct variant when expecting struct variant." ) ,
@@ -228,7 +224,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
228
224
229
225
let predicates = self . tcx . predicates_of ( def_id) . predicates ;
230
226
let where_clauses: Vec < _ > = predicates
231
- . into_iter ( )
227
+ . iter ( )
232
228
. map ( |( wc, _) | wc. subst ( self . tcx , bound_vars) )
233
229
. filter_map ( |wc| LowerInto :: < Option < chalk_ir:: QuantifiedWhereClause < RustInterner < ' tcx > > > > :: lower_into ( wc, & self . interner ) ) . collect ( ) ;
234
230
@@ -260,7 +256,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
260
256
// not there yet.
261
257
262
258
let all_impls = self . tcx . all_impls ( def_id) ;
263
- let matched_impls = all_impls. into_iter ( ) . filter ( |impl_def_id| {
259
+ let matched_impls = all_impls. filter ( |impl_def_id| {
264
260
use chalk_ir:: could_match:: CouldMatch ;
265
261
let trait_ref = self . tcx . impl_trait_ref ( * impl_def_id) . unwrap ( ) ;
266
262
let bound_vars = bound_vars_for_item ( self . tcx , * impl_def_id) ;
@@ -304,7 +300,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
304
300
_ => { }
305
301
}
306
302
}
307
- return false ;
303
+ false
308
304
}
309
305
310
306
fn associated_ty_value (
@@ -379,7 +375,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
379
375
ty:: AdtKind :: Struct | ty:: AdtKind :: Union => None ,
380
376
ty:: AdtKind :: Enum => {
381
377
let constraint = self . tcx . adt_sized_constraint ( adt_def_id) ;
382
- if constraint. 0 . len ( ) > 0 {
378
+ if ! constraint. 0 . is_empty ( ) {
383
379
unimplemented ! ( )
384
380
} else {
385
381
Some ( true )
@@ -412,7 +408,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
412
408
ty:: AdtKind :: Struct | ty:: AdtKind :: Union => None ,
413
409
ty:: AdtKind :: Enum => {
414
410
let constraint = self . tcx . adt_sized_constraint ( adt_def_id) ;
415
- if constraint. 0 . len ( ) > 0 {
411
+ if ! constraint. 0 . is_empty ( ) {
416
412
unimplemented ! ( )
417
413
} else {
418
414
Some ( true )
0 commit comments