Skip to content

Commit

Permalink
Merge pull request #23 from pythonbrad/fix_lint
Browse files Browse the repository at this point in the history
chore: fix lint
  • Loading branch information
Mindful authored Oct 23, 2024
2 parents a043fc0 + db888f5 commit e47ab9b
Show file tree
Hide file tree
Showing 6 changed files with 419 additions and 266 deletions.
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

0 comments on commit e47ab9b

Please sign in to comment.