Skip to content

Commit

Permalink
Apply linting changes
Browse files Browse the repository at this point in the history
Ran `cargo fmt -- --check`, and applied suggestions, per ci feedback.
  • Loading branch information
ewalk153 committed Jul 2, 2024
1 parent 4e6f967 commit 1d0bda1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
11 changes: 4 additions & 7 deletions crates/javy/src/apis/crypto/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use crate::quickjs::{context::Intrinsic, qjs, Ctx, Object, String as JSString, Value, Function};
use crate::{
hold, hold_and_release, val_to_string,
to_js_error, Args
};
use crate::quickjs::{context::Intrinsic, qjs, Ctx, Function, Object, String as JSString, Value};
use crate::{hold, hold_and_release, to_js_error, val_to_string, Args};
use anyhow::{bail, Error, Result};

use sha2::Sha256;
use hmac::{Hmac, Mac};
use sha2::Sha256;

/// An implemetation of crypto APIs to optimize fuel.
/// Currently, hmacSHA256 is the only function implemented.
Expand Down Expand Up @@ -58,7 +55,7 @@ fn hmac_sha256(args: Args<'_>) -> Result<Value<'_>> {

let result = mac.finalize();
let code_bytes = result.into_bytes();
let code : String = format!("{code_bytes:x}");
let code: String = format!("{code_bytes:x}");
let js_string = JSString::from_str(cx, &code);
Ok(Value::from_string(js_string?))
}
Expand Down
4 changes: 2 additions & 2 deletions crates/javy/src/apis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@
//!
//! Disabled by default.
pub(crate) mod console;
pub(crate) mod crypto;
#[cfg(feature = "json")]
pub(crate) mod json;
pub(crate) mod random;
pub(crate) mod stream_io;
pub(crate) mod text_encoding;
pub(crate) mod crypto;

pub(crate) use console::*;
pub(crate) use crypto::*;
#[cfg(feature = "json")]
pub(crate) use json::*;
pub(crate) use random::*;
pub(crate) use stream_io::*;
pub(crate) use text_encoding::*;
pub(crate) use crypto::*;
6 changes: 2 additions & 4 deletions crates/javy/src/runtime.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// use crate::quickjs::JSContextRef;
use super::from_js_error;
use crate::{
apis::{Crypto, Console, NonStandardConsole, Random, StreamIO, TextEncoding},
apis::{Console, Crypto, NonStandardConsole, Random, StreamIO, TextEncoding},
config::{JSIntrinsics, JavyIntrinsics},
Config,
};
Expand Down Expand Up @@ -147,9 +147,7 @@ impl Runtime {

if intrinsics.contains(JSIntrinsics::CRYPTO) {
// #[cfg(feature = "crypto")]
unsafe {
Crypto::add_intrinsic(ctx.as_raw())
}
unsafe { Crypto::add_intrinsic(ctx.as_raw()) }
}
});

Expand Down

0 comments on commit 1d0bda1

Please sign in to comment.