Skip to content

Commit

Permalink
Clippy fixes and add core build
Browse files Browse the repository at this point in the history
  • Loading branch information
wafflespeanut committed Jul 15, 2022
1 parent 0a28216 commit b036234
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ jobs:
run: make build-wasm-pkg
- name: Build lib
run: make build-grpc-pkg
- name: Build core
run: make build-core-pkg
- name: Run tests
run: cargo test --verbose --workspace
5 changes: 4 additions & 1 deletion ain-core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ fn main() {
let target_dir = &root.join("target");

let mut content = String::new();
File::open(lib_path).unwrap().read_to_string(&mut content).unwrap();
File::open(lib_path)
.unwrap()
.read_to_string(&mut content)
.unwrap();
let tt: TokenStream = content.parse().unwrap();
let codegen = cxx_gen::generate_header_and_cc(tt, &cxx_gen::Opt::default()).unwrap();

Expand Down
6 changes: 5 additions & 1 deletion ain-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ mod calc {

fn calc_dex_fee(algo_dusd: f64, dusd_supply: f64) -> f64;

fn calc_loan_interest_rate(reserve_dfi: f64, reserve_dusd: f64, dfi_oracle_price: f64) -> f64;
fn calc_loan_interest_rate(
reserve_dfi: f64,
reserve_dusd: f64,
dfi_oracle_price: f64,
) -> f64;
}
}

Expand Down
5 changes: 3 additions & 2 deletions ain-grpc/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub mod types {
tonic::include_proto!("types");
}

#[allow(clippy::useless_conversion)]
pub mod rpc {
tonic::include_proto!("rpc");
}
Expand All @@ -13,7 +14,7 @@ impl Serialize for types::BlockResult {
where
S: serde::Serializer,
{
if self.hash != "" {
if self.hash.is_empty() {
return serializer.serialize_str(&self.hash);
}

Expand All @@ -30,7 +31,7 @@ impl Serialize for types::Transaction {
where
S: serde::Serializer,
{
if self.hash != "" {
if self.hash.is_empty() {
return serializer.serialize_str(&self.hash);
}

Expand Down
1 change: 1 addition & 0 deletions ain-grpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ fn start_servers(
Ok(runtime)
}

#[allow(clippy::boxed_local)]
fn stop_servers(mut runtime: Box<Runtime>) -> Result<(), Box<dyn Error>> {
log::info!("Stopping gRPC and JSON RPC servers");
runtime.stop();
Expand Down

0 comments on commit b036234

Please sign in to comment.