@@ -55,7 +55,6 @@ use std::io::Write;
55
55
#[ allow( unused_imports) ]
56
56
use itertools:: Itertools as _;
57
57
58
- #[ cfg( feature = "model_unstable" ) ]
59
58
use crate :: import:: ImportError ;
60
59
61
60
/// Read a HUGR envelope from a reader.
@@ -197,19 +196,16 @@ pub enum EnvelopeError {
197
196
source : PackageEncodingError ,
198
197
} ,
199
198
/// Error importing a HUGR from a hugr-model payload.
200
- #[ cfg( feature = "model_unstable" ) ]
201
199
ModelImport {
202
200
/// The source error.
203
201
source : ImportError ,
204
202
} ,
205
203
/// Error reading a HUGR model payload.
206
- #[ cfg( feature = "model_unstable" ) ]
207
204
ModelRead {
208
205
/// The source error.
209
206
source : hugr_model:: v0:: binary:: ReadError ,
210
207
} ,
211
208
/// Error writing a HUGR model payload.
212
- #[ cfg( feature = "model_unstable" ) ]
213
209
ModelWrite {
214
210
/// The source error.
215
211
source : hugr_model:: v0:: binary:: WriteError ,
@@ -225,17 +221,9 @@ fn read_impl(
225
221
match header. format {
226
222
#[ allow( deprecated) ]
227
223
EnvelopeFormat :: PackageJson => Ok ( Package :: from_json_reader ( payload, registry) ?) ,
228
- #[ cfg( feature = "model_unstable" ) ]
229
224
EnvelopeFormat :: Model | EnvelopeFormat :: ModelWithExtensions => {
230
225
decode_model ( payload, registry, header. format )
231
226
}
232
- #[ cfg( not( feature = "model_unstable" ) ) ]
233
- EnvelopeFormat :: Model | EnvelopeFormat :: ModelWithExtensions => {
234
- Err ( EnvelopeError :: FormatUnsupported {
235
- format : header. format ,
236
- feature : Some ( "model_unstable" ) ,
237
- } )
238
- }
239
227
}
240
228
}
241
229
@@ -246,7 +234,6 @@ fn read_impl(
246
234
/// - `extension_registry`: An extension registry with additional extensions to use when
247
235
/// decoding the HUGR, if they are not already included in the package.
248
236
/// - `format`: The format of the payload.
249
- #[ cfg( feature = "model_unstable" ) ]
250
237
fn decode_model (
251
238
mut stream : impl BufRead ,
252
239
extension_registry : & ExtensionRegistry ,
@@ -286,22 +273,13 @@ fn write_impl(
286
273
match config. format {
287
274
#[ allow( deprecated) ]
288
275
EnvelopeFormat :: PackageJson => package. to_json_writer ( writer) ?,
289
- #[ cfg( feature = "model_unstable" ) ]
290
276
EnvelopeFormat :: Model | EnvelopeFormat :: ModelWithExtensions => {
291
277
encode_model ( writer, package, config. format ) ?
292
278
}
293
- #[ cfg( not( feature = "model_unstable" ) ) ]
294
- EnvelopeFormat :: Model | EnvelopeFormat :: ModelWithExtensions => {
295
- return Err ( EnvelopeError :: FormatUnsupported {
296
- format : config. format ,
297
- feature : Some ( "model_unstable" ) ,
298
- } )
299
- }
300
279
}
301
280
Ok ( ( ) )
302
281
}
303
282
304
- #[ cfg( feature = "model_unstable" ) ]
305
283
fn encode_model (
306
284
mut writer : impl Write ,
307
285
package : & Package ,
@@ -391,7 +369,6 @@ mod tests {
391
369
//#[case::empty(Package::default())] // Not currently supported
392
370
#[ case:: simple( simple_package( ) ) ]
393
371
//#[case::multi(multi_module_package())] // Not currently supported
394
- #[ cfg( feature = "model_unstable" ) ]
395
372
fn module_exts_roundtrip ( #[ case] package : Package ) {
396
373
let mut buffer = Vec :: new ( ) ;
397
374
let config = EnvelopeConfig {
@@ -417,15 +394,7 @@ mod tests {
417
394
format : EnvelopeFormat :: Model ,
418
395
zstd : None ,
419
396
} ;
420
- let res = package. store ( & mut buffer, config) ;
421
-
422
- match cfg ! ( feature = "model_unstable" ) {
423
- true => res. unwrap ( ) ,
424
- false => {
425
- assert_matches ! ( res, Err ( EnvelopeError :: FormatUnsupported { .. } ) ) ;
426
- return ;
427
- }
428
- }
397
+ package. store ( & mut buffer, config) . unwrap ( ) ;
429
398
430
399
let ( decoded_config, new_package) =
431
400
read_envelope ( BufReader :: new ( buffer. as_slice ( ) ) , & PRELUDE_REGISTRY ) . unwrap ( ) ;
0 commit comments