Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrieshiemstra authored and theduke committed Nov 7, 2020
1 parent 8e7d184 commit 8d524ff
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions libquickjs-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,39 @@ extern "C" {
fn JS_NewFloat64_real(ctx: *mut JSContext, v: f64) -> JSValue;
}

pub fn JS_DupValue(ctx: *mut JSContext, v: JSValue) {
unsafe {JS_DupValue_real(ctx, v)};
/// Increment the refcount of this value
/// # Safety
/// be safe
pub unsafe fn JS_DupValue(ctx: *mut JSContext, v: JSValue) {
JS_DupValue_real(ctx, v);
}

pub fn JS_FreeValue(ctx: *mut JSContext, v: JSValue) {
unsafe {JS_FreeValue_real(ctx, v)};
/// Decrement the refcount of this value
/// # Safety
/// be safe
pub unsafe fn JS_FreeValue(ctx: *mut JSContext, v: JSValue) {
JS_FreeValue_real(ctx, v);
}

pub fn JS_NewBool(ctx: *mut JSContext, v: bool) -> JSValue {
unsafe {JS_NewBool_real(ctx, v)}
/// create a new boolean value
/// # Safety
/// be safe
pub unsafe fn JS_NewBool(ctx: *mut JSContext, v: bool) -> JSValue {
JS_NewBool_real(ctx, v)
}

pub fn JS_NewInt32(ctx: *mut JSContext, v: i32) -> JSValue {
unsafe {JS_NewInt32_real(ctx, v)}
/// create a new int32 value
/// # Safety
/// be safe
pub unsafe fn JS_NewInt32(ctx: *mut JSContext, v: i32) -> JSValue {
JS_NewInt32_real(ctx, v)
}

pub fn JS_NewFloat64(ctx: *mut JSContext, v: f64) -> JSValue {
unsafe {JS_NewFloat64_real(ctx, v)}
/// create a new f64 value, please note that if the passed f64 fits in a i32 this will return a value with flag 0 (i32)
/// # Safety
/// be safe
pub unsafe fn JS_NewFloat64(ctx: *mut JSContext, v: f64) -> JSValue {
JS_NewFloat64_real(ctx, v)
}

#[cfg(test)]
Expand All @@ -50,8 +65,6 @@ mod tests {
fn test_eval() {
unsafe {



let rt = JS_NewRuntime();
let ctx = JS_NewContext(rt);

Expand Down

0 comments on commit 8d524ff

Please sign in to comment.