Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix lint #23

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/predict/ibus/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ static ENGINE_HEADER: &str = "../../../include/eei/engine.h";
static BINDING_FILE: &str = "src/ibus_bindings.rs";

fn main() {
let ibus_lib = pkg_config::Config::new().atleast_version("1.5.0").probe("ibus-1.0").unwrap();

let ibus_lib = pkg_config::Config::new()
.atleast_version("1.5.0")
.probe("ibus-1.0")
.unwrap();

// Tell cargo to invalidate the built crate whenever the wrapper changes
println!("cargo:rerun-if-changed={}", ENGINE_HEADER);

let bindings = ibus_lib.include_paths.iter().fold(
bindgen::Builder::default().header(ENGINE_HEADER),
| b, path| {
b.clang_arg("-I".to_string()+path.to_str().unwrap())
}
)
let bindings = ibus_lib
.include_paths
.iter()
.fold(
bindgen::Builder::default().header(ENGINE_HEADER),
|b, path| b.clang_arg("-I".to_string() + path.to_str().unwrap()),
)
.allowlist_function("ibus_.*")
.allowlist_type("IBus.*")
.allowlist_var("(IBUS_.*|GBOOL_.*)")
Expand All @@ -27,6 +30,7 @@ fn main() {
// Unwrap the Result and panic on failure.
.expect("Unable to generate bindings");

bindings.write_to_file(Path::new(BINDING_FILE))
bindings
.write_to_file(Path::new(BINDING_FILE))
.expect("Couldn't write bindings!");
}
2 changes: 1 addition & 1 deletion src/predict/ibus/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#![allow(warnings)]
include!("ibus_bindings.rs");
include!("ibus_bindings.rs");
3 changes: 2 additions & 1 deletion src/predict/lib/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
extern crate cbindgen;

use std::env;static GENERATED_HEADER: &str = "../../../include/eei/predict.h";
use std::env;
static GENERATED_HEADER: &str = "../../../include/eei/predict.h";

fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
Expand Down
Loading