From 6018b1267035b62627b0ff8b8c36f29956e7b725 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Thu, 19 Sep 2019 23:06:37 -0400 Subject: [PATCH] Format, clippy, and start the docs --- aeron_driver-sys/build.rs | 21 ++++++++++++++------- aeron_driver-sys/src/lib.rs | 2 +- src/lib.rs | 15 ++++++++++----- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/aeron_driver-sys/build.rs b/aeron_driver-sys/build.rs index 378adfb..987c2ca 100644 --- a/aeron_driver-sys/build.rs +++ b/aeron_driver-sys/build.rs @@ -1,12 +1,12 @@ use cmake::Config; use std::env; -use std::path::{Path, PathBuf}; use std::fs::canonicalize; +use std::path::{Path, PathBuf}; pub enum LinkType { Dynamic, - Static + Static, } impl LinkType { @@ -21,14 +21,14 @@ impl LinkType { fn link_lib(&self) -> &'static str { match self { LinkType::Dynamic => "dylib=", - LinkType::Static => "static=" + LinkType::Static => "static=", } } fn target_name(&self) -> &'static str { match self { LinkType::Dynamic => "aeron_driver", - LinkType::Static => "aeron_driver_static" + LinkType::Static => "aeron_driver_static", } } } @@ -42,11 +42,18 @@ pub fn main() { let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); let link_type = LinkType::detect(); - println!("cargo:rustc-link-lib={}{}", link_type.link_lib(), link_type.target_name()); + println!( + "cargo:rustc-link-lib={}{}", + link_type.link_lib(), + link_type.target_name() + ); let lib_dir = Config::new(&aeron_path) .build_target(link_type.target_name()) .build(); - println!("cargo:rustc-link-search=native={}", lib_dir.join("build/lib").display()); + println!( + "cargo:rustc-link-search=native={}", + lib_dir.join("build/lib").display() + ); println!("cargo:include={}", header_path.display()); let bindings = bindgen::Builder::default() @@ -58,4 +65,4 @@ pub fn main() { bindings .write_to_file(out_path.join("bindings.rs")) .expect("Couldn't write bindings!"); -} \ No newline at end of file +} diff --git a/aeron_driver-sys/src/lib.rs b/aeron_driver-sys/src/lib.rs index ebb1484..9f6426e 100644 --- a/aeron_driver-sys/src/lib.rs +++ b/aeron_driver-sys/src/lib.rs @@ -1,7 +1,7 @@ #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] - +#![allow(clippy::all)] include!(concat!(env!("OUT_DIR"), "/bindings.rs")); #[cfg(test)] diff --git a/src/lib.rs b/src/lib.rs index 3fa1fe1..d195ab8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,13 @@ +//! Aeron client for Rust +#![deny(missing_docs)] +/// Retrieve the C library version in (major, minor, patch) format pub fn aeron_version() -> (u32, u32, u32) { - unsafe {( - aeron_driver_sys::aeron_version_major() as u32, - aeron_driver_sys::aeron_version_minor() as u32, - aeron_driver_sys::aeron_version_patch() as u32, - )} + unsafe { + ( + aeron_driver_sys::aeron_version_major() as u32, + aeron_driver_sys::aeron_version_minor() as u32, + aeron_driver_sys::aeron_version_patch() as u32, + ) + } }