Merge pull request #321 from davibe/fix-linting-issues

Fix linting issues
pull/322/head
Dave Tucker 3 years ago committed by GitHub
commit 24597b15b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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);
} }
}; };

@ -54,21 +54,21 @@ impl std::fmt::Display for Architecture {
#[derive(Parser)] #[derive(Parser)]
pub struct Options { pub struct Options {
#[clap(long)] #[clap(long, action)]
libbpf_dir: PathBuf, libbpf_dir: PathBuf,
// sysroot options. Default to ubuntu headers installed by the // sysroot options. Default to ubuntu headers installed by the
// libc6-dev-{arm64,armel}-cross packages. // libc6-dev-{arm64,armel}-cross packages.
#[clap(long, default_value = "/usr/include/x86_64-linux-gnu")] #[clap(long, default_value = "/usr/include/x86_64-linux-gnu", action)]
x86_64_sysroot: PathBuf, x86_64_sysroot: PathBuf,
#[clap(long, default_value = "/usr/aarch64-linux-gnu/include")] #[clap(long, default_value = "/usr/aarch64-linux-gnu/include", action)]
aarch64_sysroot: PathBuf, aarch64_sysroot: PathBuf,
#[clap(long, default_value = "/usr/arm-linux-gnueabi/include")] #[clap(long, default_value = "/usr/arm-linux-gnueabi/include", action)]
armv7_sysroot: PathBuf, armv7_sysroot: PathBuf,
#[clap(long, default_value = "/usr/riscv64-linux-gnu/include")] #[clap(long, default_value = "/usr/riscv64-linux-gnu/include", action)]
riscv64_sysroot: PathBuf, riscv64_sysroot: PathBuf,
#[clap(subcommand)] #[clap(subcommand)]

@ -25,7 +25,7 @@ pub fn docs() -> Result<(), anyhow::Error> {
header_path.push("header.html"); header_path.push("header.html");
let mut header = fs::File::create(&header_path).expect("can't create header.html"); let mut header = fs::File::create(&header_path).expect("can't create header.html");
header header
.write(r#"<meta name="robots" content="noindex">"#.as_bytes()) .write_all(r#"<meta name="robots" content="noindex">"#.as_bytes())
.expect("can't write header.html contents"); .expect("can't write header.html contents");
header.flush().expect("couldn't flush contents"); header.flush().expect("couldn't flush contents");
@ -78,7 +78,7 @@ pub fn docs() -> Result<(), anyhow::Error> {
let mut robots = fs::File::create("site/robots.txt").expect("can't create robots.txt"); let mut robots = fs::File::create("site/robots.txt").expect("can't create robots.txt");
robots robots
.write( .write_all(
indoc! {r#" indoc! {r#"
User-Agent:* User-Agent:*
Disallow: / Disallow: /
@ -89,7 +89,7 @@ pub fn docs() -> Result<(), anyhow::Error> {
let mut index = fs::File::create("site/index.html").expect("can't create index.html"); let mut index = fs::File::create("site/index.html").expect("can't create index.html");
index index
.write( .write_all(
indoc! {r#" indoc! {r#"
<html> <html>
<meta name="robots" content="noindex"> <meta name="robots" content="noindex">

Loading…
Cancel
Save