aya-gen: fix lint errors

pull/321/head
Davide Bertola 2 years ago
parent ed3b690a6d
commit cbf520934a

@ -12,14 +12,15 @@ pub struct Options {
#[derive(Parser)] #[derive(Parser)]
enum Command { enum Command {
#[clap(name = "generate")] #[clap(name = "generate", action)]
Generate { Generate {
#[clap(long, default_value = "/sys/kernel/btf/vmlinux")] #[clap(long, default_value = "/sys/kernel/btf/vmlinux", action)]
btf: PathBuf, btf: PathBuf,
#[clap(long, conflicts_with = "btf")] #[clap(long, conflicts_with = "btf", action)]
header: Option<PathBuf>, header: Option<PathBuf>,
#[clap(action)]
names: Vec<String>, names: Vec<String>,
#[clap(last = true)] #[clap(last = true, action)]
bindgen_args: Vec<String>, bindgen_args: Vec<String>,
}, },
} }
@ -40,12 +41,11 @@ fn try_main() -> Result<(), anyhow::Error> {
names, names,
bindgen_args, bindgen_args,
} => { } => {
let bindings: String; let bindings: String = if let Some(header) = header {
if let Some(header) = header { generate(InputFile::Header(header), &names, &bindgen_args)?
bindings = generate(InputFile::Header(header), &names, &bindgen_args)?;
} else { } else {
bindings = generate(InputFile::Btf(btf), &names, &bindgen_args)?; generate(InputFile::Btf(btf), &names, &bindgen_args)?
} };
println!("{}", bindings); println!("{}", bindings);
} }
}; };

Loading…
Cancel
Save