File tree Expand file tree Collapse file tree 3 files changed +7
-13
lines changed
crates/intrinsic-test/src/common Expand file tree Collapse file tree 3 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,15 @@ use std::ops::Range;
55pub enum Constraint {
66 Equal ( i64 ) ,
77 Range ( Range < i64 > ) ,
8+ Set ( Vec < i64 > ) ,
89}
910
1011impl Constraint {
11- pub fn to_range ( & self ) -> Range < i64 > {
12+ pub fn to_vector ( & self ) -> Vec < i64 > {
1213 match self {
13- Constraint :: Equal ( eq) => * eq..* eq + 1 ,
14- Constraint :: Range ( range) => range. clone ( ) ,
14+ Constraint :: Equal ( eq) => vec ! [ * eq] ,
15+ Constraint :: Range ( range) => range. clone ( ) . collect :: < Vec < i64 > > ( ) ,
16+ Constraint :: Set ( values) => values. clone ( ) ,
1517 }
1618 }
1719}
Original file line number Diff line number Diff line change @@ -128,11 +128,7 @@ pub fn generate_c_constraint_blocks<T: IntrinsicTypeDefinition>(
128128 target : & str ,
129129) -> String {
130130 if let Some ( ( current, constraints) ) = constraints. split_last ( ) {
131- let range = current
132- . constraint
133- . iter ( )
134- . map ( |c| c. to_range ( ) )
135- . flat_map ( |r| r. into_iter ( ) ) ;
131+ let range = current. constraint . iter ( ) . flat_map ( |c| c. to_vector ( ) ) ;
136132
137133 let body_indentation = indentation. nested ( ) ;
138134 range
Original file line number Diff line number Diff line change @@ -177,11 +177,7 @@ pub fn generate_rust_constraint_blocks<T: IntrinsicTypeDefinition>(
177177 name : String ,
178178) -> String {
179179 if let Some ( ( current, constraints) ) = constraints. split_last ( ) {
180- let range = current
181- . constraint
182- . iter ( )
183- . map ( |c| c. to_range ( ) )
184- . flat_map ( |r| r. into_iter ( ) ) ;
180+ let range = current. constraint . iter ( ) . flat_map ( |c| c. to_vector ( ) ) ;
185181
186182 let body_indentation = indentation. nested ( ) ;
187183 range
You can’t perform that action at this time.
0 commit comments