@@ -8,7 +8,7 @@ convert_enums!(
8
8
egglog:: ast:: Literal : "{:}" => Literal {
9
9
Int ( value: i64 )
10
10
i -> egglog:: ast:: Literal :: Int ( i. value) ,
11
- egglog:: ast:: Literal :: Int ( i) => Int { value: i . clone ( ) } ;
11
+ egglog:: ast:: Literal :: Int ( i) => Int { value: * i } ;
12
12
F64 ( value: WrappedOrderedF64 )
13
13
f -> egglog:: ast:: Literal :: F64 ( f. value. 0 ) ,
14
14
egglog:: ast:: Literal :: F64 ( f) => F64 { value: WrappedOrderedF64 ( * f) } ;
@@ -27,16 +27,16 @@ convert_enums!(
27
27
v -> egglog:: ast:: Expr :: Var ( ( & v. name) . into( ) ) ,
28
28
egglog:: ast:: Expr :: Var ( v) => Var { name: v. to_string( ) } ;
29
29
Call ( name: String , args: Vec <Expr >)
30
- c -> egglog:: ast:: Expr :: Call ( ( & c. name) . into( ) , ( & c. args) . into_iter ( ) . map( |e| e. into( ) ) . collect( ) ) ,
30
+ c -> egglog:: ast:: Expr :: Call ( ( & c. name) . into( ) , c. args. iter ( ) . map( |e| e. into( ) ) . collect( ) ) ,
31
31
egglog:: ast:: Expr :: Call ( c, a) => Call {
32
32
name: c. to_string( ) ,
33
- args: a. into_iter ( ) . map( |e| e. into( ) ) . collect( )
33
+ args: a. iter ( ) . map( |e| e. into( ) ) . collect( )
34
34
}
35
35
} ;
36
36
egglog:: ast:: Fact : "{}" => Fact_ {
37
37
Eq ( exprs: Vec <Expr >)
38
- eq -> egglog:: ast:: Fact :: Eq ( ( & eq. exprs) . into_iter ( ) . map( |e| e. into( ) ) . collect( ) ) ,
39
- egglog:: ast:: Fact :: Eq ( e) => Eq { exprs: e. into_iter ( ) . map( |e| e. into( ) ) . collect( ) } ;
38
+ eq -> egglog:: ast:: Fact :: Eq ( eq. exprs. iter ( ) . map( |e| e. into( ) ) . collect( ) ) ,
39
+ egglog:: ast:: Fact :: Eq ( e) => Eq { exprs: e. iter ( ) . map( |e| e. into( ) ) . collect( ) } ;
40
40
Fact ( expr: Expr )
41
41
f -> egglog:: ast:: Fact :: Fact ( ( & f. expr) . into( ) ) ,
42
42
egglog:: ast:: Fact :: Fact ( e) => Fact { expr: e. into( ) }
@@ -46,24 +46,24 @@ convert_enums!(
46
46
d -> egglog:: ast:: Action :: Let ( ( & d. lhs) . into( ) , ( & d. rhs) . into( ) ) ,
47
47
egglog:: ast:: Action :: Let ( n, e) => Let { lhs: n. to_string( ) , rhs: e. into( ) } ;
48
48
Set ( lhs: String , args: Vec <Expr >, rhs: Expr )
49
- s -> egglog:: ast:: Action :: Set ( ( & s. lhs) . into( ) , ( & s. args) . into_iter ( ) . map( |e| e. into( ) ) . collect( ) , ( & s. rhs) . into( ) ) ,
49
+ s -> egglog:: ast:: Action :: Set ( ( & s. lhs) . into( ) , s. args. iter ( ) . map( |e| e. into( ) ) . collect( ) , ( & s. rhs) . into( ) ) ,
50
50
egglog:: ast:: Action :: Set ( n, a, e) => Set {
51
51
lhs: n. to_string( ) ,
52
- args: a. into_iter ( ) . map( |e| e. into( ) ) . collect( ) ,
52
+ args: a. iter ( ) . map( |e| e. into( ) ) . collect( ) ,
53
53
rhs: e. into( )
54
54
} ;
55
55
SetNoTrack ( lhs: String , args: Vec <Expr >, rhs: Expr )
56
- s -> egglog:: ast:: Action :: SetNoTrack ( ( & s. lhs) . into( ) , ( & s. args) . into_iter ( ) . map( |e| e. into( ) ) . collect( ) , ( & s. rhs) . into( ) ) ,
56
+ s -> egglog:: ast:: Action :: SetNoTrack ( ( & s. lhs) . into( ) , s. args. iter ( ) . map( |e| e. into( ) ) . collect( ) , ( & s. rhs) . into( ) ) ,
57
57
egglog:: ast:: Action :: SetNoTrack ( n, a, e) => SetNoTrack {
58
58
lhs: n. to_string( ) ,
59
- args: a. into_iter ( ) . map( |e| e. into( ) ) . collect( ) ,
59
+ args: a. iter ( ) . map( |e| e. into( ) ) . collect( ) ,
60
60
rhs: e. into( )
61
61
} ;
62
62
Delete ( sym: String , args: Vec <Expr >)
63
- d -> egglog:: ast:: Action :: Delete ( ( & d. sym) . into( ) , ( & d. args) . into_iter ( ) . map( |e| e. into( ) ) . collect( ) ) ,
63
+ d -> egglog:: ast:: Action :: Delete ( ( & d. sym) . into( ) , d. args. iter ( ) . map( |e| e. into( ) ) . collect( ) ) ,
64
64
egglog:: ast:: Action :: Delete ( n, a) => Delete {
65
65
sym: n. to_string( ) ,
66
- args: a. into_iter ( ) . map( |e| e. into( ) ) . collect( )
66
+ args: a. iter ( ) . map( |e| e. into( ) ) . collect( )
67
67
} ;
68
68
Union ( lhs: Expr , rhs: Expr )
69
69
u -> egglog:: ast:: Action :: Union ( ( & u. lhs) . into( ) , ( & u. rhs) . into( ) ) ,
@@ -86,8 +86,8 @@ convert_enums!(
86
86
r -> egglog:: ast:: Schedule :: Run ( ( & r. config) . into( ) ) ,
87
87
egglog:: ast:: Schedule :: Run ( c) => Run { config: c. into( ) } ;
88
88
Sequence ( schedules: Vec <Schedule >)
89
- s -> egglog:: ast:: Schedule :: Sequence ( ( & s. schedules) . into_iter ( ) . map( |s| s. into( ) ) . collect( ) ) ,
90
- egglog:: ast:: Schedule :: Sequence ( s) => Sequence { schedules: s. into_iter ( ) . map( |s| s. into( ) ) . collect( ) }
89
+ s -> egglog:: ast:: Schedule :: Sequence ( s. schedules. iter ( ) . map( |s| s. into( ) ) . collect( ) ) ,
90
+ egglog:: ast:: Schedule :: Sequence ( s) => Sequence { schedules: s. iter ( ) . map( |s| s. into( ) ) . collect( ) }
91
91
} ;
92
92
egglog:: ast:: Command : "{}" => Command {
93
93
SetOption ( name: String , value: Expr )
@@ -102,11 +102,11 @@ convert_enums!(
102
102
Datatype ( name: String , variants: Vec <Variant >)
103
103
d -> egglog:: ast:: Command :: Datatype {
104
104
name: ( & d. name) . into( ) ,
105
- variants: ( & d. variants) . into_iter ( ) . map( |v| v. into( ) ) . collect( )
105
+ variants: d. variants. iter ( ) . map( |v| v. into( ) ) . collect( )
106
106
} ,
107
107
egglog:: ast:: Command :: Datatype { name, variants} => Datatype {
108
108
name: name. to_string( ) ,
109
- variants: variants. into_iter ( ) . map( |v| v. into( ) ) . collect( )
109
+ variants: variants. iter ( ) . map( |v| v. into( ) ) . collect( )
110
110
} ;
111
111
Declare ( name: String , sort: String )
112
112
d -> egglog:: ast:: Command :: Declare {
@@ -120,11 +120,11 @@ convert_enums!(
120
120
Sort ( name: String , presort_and_args: Option <( String , Vec <Expr >) >)
121
121
s -> egglog:: ast:: Command :: Sort (
122
122
( & s. name) . into( ) ,
123
- ( & s. presort_and_args) . as_ref( ) . map( |( p, a) | ( p. into( ) , a. into_iter ( ) . map( |e| e. into( ) ) . collect( ) ) )
123
+ s. presort_and_args. as_ref( ) . map( |( p, a) | ( p. into( ) , a. iter ( ) . map( |e| e. into( ) ) . collect( ) ) )
124
124
) ,
125
125
egglog:: ast:: Command :: Sort ( n, presort_and_args) => Sort {
126
126
name: n. to_string( ) ,
127
- presort_and_args: presort_and_args. as_ref( ) . map( |( p, a) | ( p. to_string( ) , a. into_iter ( ) . map( |e| e. into( ) ) . collect( ) ) )
127
+ presort_and_args: presort_and_args. as_ref( ) . map( |( p, a) | ( p. to_string( ) , a. iter ( ) . map( |e| e. into( ) ) . collect( ) ) )
128
128
} ;
129
129
Function ( decl: FunctionDecl )
130
130
f -> egglog:: ast:: Command :: Function ( ( & f. decl) . into( ) ) ,
@@ -186,12 +186,12 @@ convert_enums!(
186
186
} ;
187
187
Calc ( identifiers: Vec <IdentSort >, exprs: Vec <Expr >)
188
188
c -> egglog:: ast:: Command :: Calc (
189
- ( & c. identifiers) . into_iter ( ) . map( |i| i. into( ) ) . collect( ) ,
190
- ( & c. exprs) . into_iter ( ) . map( |e| e. into( ) ) . collect( )
189
+ c. identifiers. iter ( ) . map( |i| i. into( ) ) . collect( ) ,
190
+ c. exprs. iter ( ) . map( |e| e. into( ) ) . collect( )
191
191
) ,
192
192
egglog:: ast:: Command :: Calc ( identifiers, exprs) => Calc {
193
- identifiers: identifiers. into_iter ( ) . map( |i| i. into( ) ) . collect( ) ,
194
- exprs: exprs. into_iter ( ) . map( |e| e. into( ) ) . collect( )
193
+ identifiers: identifiers. iter ( ) . map( |i| i. into( ) ) . collect( ) ,
194
+ exprs: exprs. iter ( ) . map( |e| e. into( ) ) . collect( )
195
195
} ;
196
196
Extract ( variants: usize , expr: Expr )
197
197
e -> egglog:: ast:: Command :: Extract {
@@ -203,8 +203,8 @@ convert_enums!(
203
203
expr: e. into( )
204
204
} ;
205
205
Check ( facts: Vec <Fact_ >)
206
- c -> egglog:: ast:: Command :: Check ( ( & c. facts) . into_iter ( ) . map( |f| f. into( ) ) . collect( ) ) ,
207
- egglog:: ast:: Command :: Check ( facts) => Check { facts: facts. into_iter ( ) . map( |f| f. into( ) ) . collect( ) } ;
206
+ c -> egglog:: ast:: Command :: Check ( c. facts. iter ( ) . map( |f| f. into( ) ) . collect( ) ) ,
207
+ egglog:: ast:: Command :: Check ( facts) => Check { facts: facts. iter ( ) . map( |f| f. into( ) ) . collect( ) } ;
208
208
Print ( name: String , length: usize )
209
209
p -> egglog:: ast:: Command :: Print ( ( & p. name) . into( ) , p. length) ,
210
210
egglog:: ast:: Command :: Print ( n, l) => Print {
@@ -217,11 +217,11 @@ convert_enums!(
217
217
Output ( file: String , exprs: Vec <Expr >)
218
218
o -> egglog:: ast:: Command :: Output {
219
219
file: ( & o. file) . into( ) ,
220
- exprs: ( & o. exprs) . into_iter ( ) . map( |e| e. into( ) ) . collect( )
220
+ exprs: o. exprs. iter ( ) . map( |e| e. into( ) ) . collect( )
221
221
} ,
222
222
egglog:: ast:: Command :: Output { file, exprs} => Output {
223
223
file: file. to_string( ) ,
224
- exprs: exprs. into_iter ( ) . map( |e| e. into( ) ) . collect( )
224
+ exprs: exprs. iter ( ) . map( |e| e. into( ) ) . collect( )
225
225
} ;
226
226
Input ( name: String , file: String )
227
227
i -> egglog:: ast:: Command :: Input {
@@ -278,34 +278,34 @@ convert_struct!(
278
278
types: Vec <String >,
279
279
cost: Option <usize > = None
280
280
)
281
- v -> egglog:: ast:: Variant { name: ( & v. name) . into( ) , types: ( & v. types) . into_iter ( ) . map( |v| v. into( ) ) . collect( ) , cost: v. cost} ,
281
+ v -> egglog:: ast:: Variant { name: ( & v. name) . into( ) , types: v. types. iter ( ) . map( |v| v. into( ) ) . collect( ) , cost: v. cost} ,
282
282
v -> Variant { name: v. name. to_string( ) , types: v. types. iter( ) . map( |v| v. to_string( ) ) . collect( ) , cost: v. cost} ;
283
283
egglog:: ast:: Schema : "{:?}" => Schema (
284
284
input: Vec <String >,
285
285
output: String
286
286
)
287
- s -> egglog:: ast:: Schema { input: ( & s. input) . into_iter ( ) . map( |v| v. into( ) ) . collect( ) , output: ( & s. output) . into( ) } ,
287
+ s -> egglog:: ast:: Schema { input: s. input. iter ( ) . map( |v| v. into( ) ) . collect( ) , output: ( & s. output) . into( ) } ,
288
288
s -> Schema { input: s. input. iter( ) . map( |v| v. to_string( ) ) . collect( ) , output: s. output. to_string( ) } ;
289
289
egglog:: ast:: Rule : "{}" => Rule (
290
290
head: Vec <Action >,
291
291
body: Vec <Fact_ >
292
292
)
293
- r -> egglog:: ast:: Rule { head: ( & r. head) . into_iter ( ) . map( |v| v. into( ) ) . collect( ) , body: ( & r. body) . into_iter ( ) . map( |v| v. into( ) ) . collect( ) } ,
293
+ r -> egglog:: ast:: Rule { head: r. head. iter ( ) . map( |v| v. into( ) ) . collect( ) , body: r. body. iter ( ) . map( |v| v. into( ) ) . collect( ) } ,
294
294
r -> Rule { head: r. head. iter( ) . map( |v| v. into( ) ) . collect( ) , body: r. body. iter( ) . map( |v| v. into( ) ) . collect( ) } ;
295
295
egglog:: ast:: Rewrite : "{:?}" => Rewrite (
296
296
lhs: Expr ,
297
297
rhs: Expr ,
298
298
conditions: Vec <Fact_ > = Vec :: new( )
299
299
)
300
- r -> egglog:: ast:: Rewrite { lhs: ( & r. lhs) . into( ) , rhs: ( & r. rhs) . into( ) , conditions: ( & r. conditions) . into_iter ( ) . map( |v| v. into( ) ) . collect( ) } ,
300
+ r -> egglog:: ast:: Rewrite { lhs: ( & r. lhs) . into( ) , rhs: ( & r. rhs) . into( ) , conditions: r. conditions. iter ( ) . map( |v| v. into( ) ) . collect( ) } ,
301
301
r -> Rewrite { lhs: ( & r. lhs) . into( ) , rhs: ( & r. rhs) . into( ) , conditions: r. conditions. iter( ) . map( |v| v. into( ) ) . collect( ) } ;
302
302
egglog:: ast:: RunConfig : "{:?}" => RunConfig (
303
303
ruleset: String ,
304
304
limit: usize ,
305
305
until: Option <Vec <Fact_ >>
306
306
)
307
- r -> egglog:: ast:: RunConfig { ruleset: ( & r. ruleset) . into( ) , limit: r. limit, until: r. until. as_ref( ) . map( |v| v. into_iter ( ) . map( |v| v. into( ) ) . collect( ) ) } ,
308
- r -> RunConfig { ruleset: r. ruleset. to_string( ) , limit: r. limit, until: r. until. as_ref( ) . map( |v| v. into_iter ( ) . map( |v| v. into( ) ) . collect( ) ) } ;
307
+ r -> egglog:: ast:: RunConfig { ruleset: ( & r. ruleset) . into( ) , limit: r. limit, until: r. until. as_ref( ) . map( |v| v. iter ( ) . map( |v| v. into( ) ) . collect( ) ) } ,
308
+ r -> RunConfig { ruleset: r. ruleset. to_string( ) , limit: r. limit, until: r. until. as_ref( ) . map( |v| v. iter ( ) . map( |v| v. into( ) ) . collect( ) ) } ;
309
309
egglog:: ast:: IdentSort : "{:?}" => IdentSort (
310
310
ident: String ,
311
311
sort: String
@@ -331,7 +331,7 @@ convert_struct!(
331
331
332
332
impl FromPyObject < ' _ > for Box < Schedule > {
333
333
fn extract ( ob : & ' _ PyAny ) -> PyResult < Self > {
334
- ob. extract :: < Schedule > ( ) . map ( |f| Box :: new ( f ) )
334
+ ob. extract :: < Schedule > ( ) . map ( Box :: new)
335
335
}
336
336
}
337
337
@@ -343,7 +343,7 @@ impl IntoPy<PyObject> for Box<Schedule> {
343
343
344
344
impl FromPyObject < ' _ > for Box < Command > {
345
345
fn extract ( ob : & ' _ PyAny ) -> PyResult < Self > {
346
- ob. extract :: < Command > ( ) . map ( |f| Box :: new ( f ) )
346
+ ob. extract :: < Command > ( ) . map ( Box :: new)
347
347
}
348
348
}
349
349
@@ -394,8 +394,7 @@ impl FromPyObject<'_> for WrappedDuration {
394
394
Ok ( WrappedDuration ( std:: time:: Duration :: new (
395
395
py_delta. get_days ( ) as u64 * 24 * 60 * 60 + py_delta. get_seconds ( ) as u64 ,
396
396
py_delta. get_microseconds ( ) as u32 * 1000 ,
397
- ) )
398
- . into ( ) )
397
+ ) ) )
399
398
}
400
399
}
401
400
0 commit comments