Skip to content

Commit 347b47e

Browse files
clippy fixes
1 parent e3d448e commit 347b47e

4 files changed

Lines changed: 9 additions & 16 deletions

File tree

src/cache.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct CacheEntry<O> {
2323
pub struct Cache<K: std::cmp::Eq + std::hash::Hash, O> {
2424
// on every get remove and add (oldest items come first)
2525
entries: LinkedHashMap<K, CacheEntry<O>>,
26+
#[allow(clippy::type_complexity)]
2627
producer: Box<dyn Fn(&K) -> Option<O> + Send>,
2728
max_inactive_time: Duration,
2829
inactive_resolution: Duration,

src/js_utils/adapters.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -389,16 +389,10 @@ pub trait JsRealmAdapter {
389389
args_fac.push(realm.to_js_value_facade(arg)?);
390390
}
391391
let fut = js_function(this_fac, args_fac);
392-
realm.js_promise_create_resolving_async(
393-
async move {
394-
let res = fut.await;
395-
res
396-
},
397-
|realm, pres| {
398-
//
399-
realm.from_js_value_facade(pres)
400-
},
401-
)
392+
realm.js_promise_create_resolving_async(async move { fut.await }, |realm, pres| {
393+
//
394+
realm.from_js_value_facade(pres)
395+
})
402396
},
403397
arg_count,
404398
)

src/js_utils/facades.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ pub trait JsRuntimeFacade {
235235
}
236236

237237
/// the JsValueType represents the type of value for a JSValue
238-
#[derive(PartialEq, Copy, Clone)]
238+
#[derive(PartialEq, Copy, Clone, Eq)]
239239
pub enum JsValueType {
240240
I32,
241241
F64,

src/js_utils/facades/values.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ impl CachedJsArrayRef {
214214
&self,
215215
rti: &R,
216216
) -> Result<Vec<JsValueFacade>, JsError> {
217-
let res = self
218-
.cached_object
217+
self.cached_object
219218
.with_obj(rti, |realm, arr| {
220219
let mut vec: Vec<JsValueFacade> = vec![];
221220
realm.js_array_traverse_mut(arr, |_index, element| {
@@ -224,8 +223,7 @@ impl CachedJsArrayRef {
224223
})?;
225224
Ok(vec)
226225
})
227-
.await?;
228-
res
226+
.await?
229227
}
230228
}
231229

@@ -454,7 +452,7 @@ impl JsValueFacade {
454452
}
455453
pub fn get_str(&self) -> &str {
456454
match self {
457-
JsValueFacade::String { val } => &*val,
455+
JsValueFacade::String { val } => val,
458456
_ => {
459457
panic!("Not a string");
460458
}

0 commit comments

Comments
 (0)