Skip to content

Commit 5ddad84

Browse files
Use const fn where clippy says it is possible.
1 parent 3f46f84 commit 5ddad84

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ impl JSContext {
1515
/// # Safety
1616
///
1717
/// Ensure `raw` is valid.
18-
pub unsafe fn from_raw(raw: sys::JSGlobalContextRef) -> Self {
18+
pub const unsafe fn from_raw(raw: sys::JSGlobalContextRef) -> Self {
1919
Self { raw }
2020
}
2121

src/exception.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::{sys, JSException, JSString, JSValue};
1010

1111
impl JSException {
1212
/// Return the underlying value backing the exception.
13-
pub fn underlying_value(&self) -> &JSValue {
13+
pub const fn underlying_value(&self) -> &JSValue {
1414
&self.value
1515
}
1616

src/object.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl JSObject {
1414
/// # Safety
1515
///
1616
/// Ensure `raw` is valid.
17-
pub unsafe fn from_raw(ctx: sys::JSContextRef, raw: sys::JSObjectRef) -> Self {
17+
pub const unsafe fn from_raw(ctx: sys::JSContextRef, raw: sys::JSObjectRef) -> Self {
1818
Self {
1919
raw,
2020
value: JSValue::from_raw(ctx, raw),

src/typed_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ impl JSTypedArray {
1313
/// # Safety
1414
///
1515
/// Ensure `raw` is valid, and represents a typed array.
16-
pub(crate) unsafe fn from_raw(ctx: sys::JSContextRef, raw: sys::JSObjectRef) -> Self {
16+
pub(crate) const unsafe fn from_raw(ctx: sys::JSContextRef, raw: sys::JSObjectRef) -> Self {
1717
Self { raw, ctx }
1818
}
1919

src/value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl JSValue {
1818
/// # Safety
1919
///
2020
/// Ensure `raw` is valid.
21-
pub unsafe fn from_raw(ctx: sys::JSContextRef, raw: sys::JSValueRef) -> Self {
21+
pub const unsafe fn from_raw(ctx: sys::JSContextRef, raw: sys::JSValueRef) -> Self {
2222
Self { raw, ctx }
2323
}
2424

0 commit comments

Comments
 (0)