77//! tool. `wasm-mutate` can serve as a custom mutator for mutation-based
88//! fuzzing.
99
10- #![ cfg_attr( not( feature = "structopt " ) , deny( missing_docs) ) ]
10+ #![ cfg_attr( not( feature = "clap " ) , deny( missing_docs) ) ]
1111
1212mod error;
1313mod info;
@@ -31,8 +31,8 @@ use mutators::Mutator;
3131use rand:: { rngs:: SmallRng , Rng , SeedableRng } ;
3232use std:: { cell:: Cell , sync:: Arc } ;
3333
34- #[ cfg( feature = "structopt " ) ]
35- use structopt :: StructOpt ;
34+ #[ cfg( feature = "clap " ) ]
35+ use clap :: Parser ;
3636
3737macro_rules! define_mutators {
3838 ( @count) => { 0 } ;
@@ -104,7 +104,7 @@ macro_rules! define_mutators {
104104// NB: only add this doc comment if we are not building the CLI, since otherwise
105105// it will override the main CLI's about text.
106106#[ cfg_attr(
107- not( feature = "structopt " ) ,
107+ not( feature = "clap " ) ,
108108 doc = r###"
109109A WebAssembly test case mutator.
110110
@@ -149,36 +149,36 @@ for mutated_wasm in mutate.run(&input_wasm)? {
149149```
150150"###
151151) ]
152- #[ cfg_attr( feature = "structopt " , derive( StructOpt ) ) ]
152+ #[ cfg_attr( feature = "clap " , derive( Parser ) ) ]
153153#[ derive( Clone ) ]
154154pub struct WasmMutate < ' wasm > {
155155 /// The RNG seed used to choose which transformation to apply. Given the
156156 /// same input Wasm and same seed, `wasm-mutate` will always generate the
157157 /// same output Wasm.
158- #[ cfg_attr( feature = "structopt " , structopt ( short, long) ) ]
158+ #[ cfg_attr( feature = "clap " , clap ( short, long) ) ]
159159 seed : u64 ,
160160
161161 /// Only perform semantics-preserving transformations on the Wasm module.
162- #[ cfg_attr( feature = "structopt " , structopt ( long) ) ]
162+ #[ cfg_attr( feature = "clap " , clap ( long) ) ]
163163 preserve_semantics : bool ,
164164
165165 /// Fuel to control the time of the mutation.
166- #[ cfg_attr( feature = "structopt " , structopt ( skip = Cell :: new( u64 :: MAX ) ) ) ]
166+ #[ cfg_attr( feature = "clap " , clap ( skip = Cell :: new( u64 :: MAX ) ) ) ]
167167 fuel : Cell < u64 > ,
168168 /// Only perform size-reducing transformations on the Wasm module. This
169169 /// allows `wasm-mutate` to be used as a test case reducer.
170- #[ cfg_attr( feature = "structopt " , structopt ( long) ) ]
170+ #[ cfg_attr( feature = "clap " , clap ( long) ) ]
171171 reduce : bool ,
172172
173173 // Note: this is only exposed via the programmatic interface, not via the
174174 // CLI.
175- #[ cfg_attr( feature = "structopt " , structopt ( skip = None ) ) ]
175+ #[ cfg_attr( feature = "clap " , clap ( skip = None ) ) ]
176176 raw_mutate_func : Option < Arc < dyn Fn ( & mut Vec < u8 > ) -> Result < ( ) > > > ,
177177
178- #[ cfg_attr( feature = "structopt " , structopt ( skip = None ) ) ]
178+ #[ cfg_attr( feature = "clap " , clap ( skip = None ) ) ]
179179 rng : Option < SmallRng > ,
180180
181- #[ cfg_attr( feature = "structopt " , structopt ( skip = None ) ) ]
181+ #[ cfg_attr( feature = "clap " , clap ( skip = None ) ) ]
182182 info : Option < ModuleInfo < ' wasm > > ,
183183}
184184
0 commit comments