From 12b794173e6354717dc46b8dd9d8dd3295955052 Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Fri, 21 Apr 2023 08:35:09 +0800 Subject: [PATCH] Cleanup warnings, fmt --- lib/ain-cpp-imports/build.rs | 21 ++++++++++++++------- lib/ain-cpp-imports/src/bridge.rs | 2 +- lib/ain-cpp-imports/src/lib.rs | 25 ++++++++++++++++--------- lib/ain-grpc/src/gen/types.rs | 1 - 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/lib/ain-cpp-imports/build.rs b/lib/ain-cpp-imports/build.rs index 6db88d0a06..e4d85fabf0 100644 --- a/lib/ain-cpp-imports/build.rs +++ b/lib/ain-cpp-imports/build.rs @@ -5,27 +5,34 @@ fn main() -> Result<(), Box> { let pkg_name = env::var("CARGO_PKG_NAME")?; let manifest_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?); - let cpp_src_path = &manifest_path.parent() + let cpp_src_path = &manifest_path + .parent() .and_then(|x| x.parent()) - .and_then(|x| Some(x.join("src"))); - + .map(|x| x.join("src")); + let cpp_src_path = match cpp_src_path.as_ref() { Some(r) => Ok(r), - None => Err("path err") + None => Err("path err"), }?; let ffi_rs_src_path = &manifest_path.join("src/bridge.rs"); let ffi_exports_h_path = &cpp_src_path.join("ffi/ffiexports.h"); cxx_build::bridge(ffi_rs_src_path) - .include(&cpp_src_path) + .include(cpp_src_path) .cpp_link_stdlib("stdc++") .flag_if_supported("-std=c++17") .flag_if_supported("-Wno-unused-parameter") .compile(pkg_name.as_str()); - println!("cargo:rerun-if-changed={}", ffi_rs_src_path.to_string_lossy()); - println!("cargo:rerun-if-changed={}", &ffi_exports_h_path.to_string_lossy()); + println!( + "cargo:rerun-if-changed={}", + ffi_rs_src_path.to_string_lossy() + ); + println!( + "cargo:rerun-if-changed={}", + &ffi_exports_h_path.to_string_lossy() + ); Ok(()) } diff --git a/lib/ain-cpp-imports/src/bridge.rs b/lib/ain-cpp-imports/src/bridge.rs index 9bcd37d4f6..b2a3f40387 100644 --- a/lib/ain-cpp-imports/src/bridge.rs +++ b/lib/ain-cpp-imports/src/bridge.rs @@ -9,4 +9,4 @@ pub mod ffi { fn getAccounts() -> Vec; fn getDatadir() -> String; } -} \ No newline at end of file +} diff --git a/lib/ain-cpp-imports/src/lib.rs b/lib/ain-cpp-imports/src/lib.rs index e99a8703a6..0bc3213233 100644 --- a/lib/ain-cpp-imports/src/lib.rs +++ b/lib/ain-cpp-imports/src/lib.rs @@ -1,4 +1,3 @@ - use std::error::Error; #[cfg(not(any(test, bench, example, doc)))] @@ -11,11 +10,21 @@ use bridge::ffi; #[allow(non_snake_case)] mod ffi { const UNIMPL_MSG: &'static str = "This cannot be used on a test path"; - pub fn getChainId() -> u64 { unimplemented!("{}", UNIMPL_MSG) } - pub fn isMining() -> bool { unimplemented!("{}", UNIMPL_MSG) } - pub fn publishEthTransaction(_data: Vec) -> bool { unimplemented!("{}", UNIMPL_MSG) } - pub fn getAccounts() -> Vec { unimplemented!("{}", UNIMPL_MSG) } - pub fn getDatadir() -> String { unimplemented!("{}", UNIMPL_MSG) } + pub fn getChainId() -> u64 { + unimplemented!("{}", UNIMPL_MSG) + } + pub fn isMining() -> bool { + unimplemented!("{}", UNIMPL_MSG) + } + pub fn publishEthTransaction(_data: Vec) -> bool { + unimplemented!("{}", UNIMPL_MSG) + } + pub fn getAccounts() -> Vec { + unimplemented!("{}", UNIMPL_MSG) + } + pub fn getDatadir() -> String { + unimplemented!("{}", UNIMPL_MSG) + } } pub fn get_chain_id() -> Result> { @@ -44,6 +53,4 @@ pub fn get_datadir() -> Result> { } #[cfg(test)] -mod tests { - -} \ No newline at end of file +mod tests {} diff --git a/lib/ain-grpc/src/gen/types.rs b/lib/ain-grpc/src/gen/types.rs index 1af38927fb..3636b0ed20 100644 --- a/lib/ain-grpc/src/gen/types.rs +++ b/lib/ain-grpc/src/gen/types.rs @@ -1260,4 +1260,3 @@ pub struct EthSyncingResult { #[prost(message, optional, tag = "2")] pub sync_info: ::core::option::Option, } -