From 6cfd3d6ad7002b1ad10f2f8deb7d430c9b0855c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joseLu=C3=ADs?= Date: Mon, 17 Aug 2020 18:21:05 +0200 Subject: [PATCH] rust: fix clippy compat with bindgen and fix a couple of lints in plane.rs --- rust/src/lib.rs | 11 +++++++++-- rust/src/plane.rs | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 6e6f7b283..c2dc2f6f1 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -3,6 +3,15 @@ #![allow(non_snake_case)] #![no_std] +#![allow(clippy::too_many_arguments)] + +// see https://github.com/rust-lang/rust-bindgen/issues/1470 +#[allow(clippy::all)] +mod bindings { + include!(concat!(env!("OUT_DIR"), "/bindings.rs")); +} +pub use bindings::*; + mod cells; mod channel; mod key; @@ -22,8 +31,6 @@ pub use pixel::*; pub use plane::*; pub use types::*; -include!(concat!(env!("OUT_DIR"), "/bindings.rs")); - #[cfg(test)] mod tests { use core::ptr::{null, null_mut}; diff --git a/rust/src/plane.rs b/rust/src/plane.rs index 59e864ea3..b5d0eae66 100644 --- a/rust/src/plane.rs +++ b/rust/src/plane.rs @@ -230,7 +230,7 @@ pub fn ncplane_dim_x(plane: &ncplane) -> i32 { unsafe { let mut x = 0; ffi::ncplane_dim_yx(plane, null_mut(), &mut x); - return x; + x } } @@ -241,7 +241,7 @@ pub fn ncplane_dim_y(plane: &ncplane) -> i32 { unsafe { let mut y = 0; ffi::ncplane_dim_yx(plane, &mut y, null_mut()); - return y; + y } } @@ -353,7 +353,7 @@ pub fn ncplane_perimeter(plane: &mut ncplane, ul: &cell, ur: &cell, ll: &cell, l /// // TODO: TEST #[inline] -pub fn ncplane_putstr(plane: *mut ncplane, _str: &str) -> i32 { +pub fn ncplane_putstr(plane: &mut ncplane, _str: &str) -> i32 { unsafe { ffi::ncplane_putstr_yx( plane,