Skip to content

Commit

Permalink
enable unused_qualifications lint
Browse files Browse the repository at this point in the history
  • Loading branch information
y21 committed Nov 13, 2024
1 parent 3b2c157 commit b708da9
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 48 deletions.
6 changes: 3 additions & 3 deletions crates/dash_vm/src/gc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ fn const_checks_for_alloc<T, M>() {
assert!(size_of::<T>() < 1024);
assert!(size_of::<M>() < 256);
// We could store its `drop_in_place` as well to support it but it's not needed ATP.
assert!(!std::mem::needs_drop::<M>());
assert!(!mem::needs_drop::<M>());
}
}

Expand Down Expand Up @@ -364,7 +364,7 @@ impl Chunk {
alloc_start: allocation_start as u16,
data_index,
drop_in_place: unsafe {
std::mem::transmute::<unsafe fn(*mut T), unsafe fn(*const ())>(std::ptr::drop_in_place::<T> as _)
mem::transmute::<unsafe fn(*mut T), unsafe fn(*const ())>(ptr::drop_in_place::<T> as _)
},
};
let info_id = if let Some(info_id) = info_id {
Expand Down Expand Up @@ -407,7 +407,7 @@ impl Chunk {
data_index,
alloc_start: self.at as u16,
drop_in_place: unsafe {
std::mem::transmute::<unsafe fn(*mut T), unsafe fn(*const ())>(std::ptr::drop_in_place::<T> as _)
mem::transmute::<unsafe fn(*mut T), unsafe fn(*const ())>(ptr::drop_in_place::<T> as _)
},
});

Expand Down
6 changes: 3 additions & 3 deletions crates/dash_vm/src/js_std/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,12 @@ pub fn for_each_js_iterator_element<B, F: FnMut(&mut LocalScope<'_>, Value) -> R
break;
}
let value = item.get_property(scope, sym::value.into()).root(scope)?;
if let ControlFlow::Break(val) = f(scope, value)? {
return Ok(ControlFlow::Break(val));
if let Break(val) = f(scope, value)? {
return Ok(Break(val));
}
}

Ok(ControlFlow::Continue(()))
Ok(Continue(()))
}

pub fn from(cx: CallContext) -> Result<Value, Value> {
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_vm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![cfg_attr(dash_lints, feature(register_tool))]
#![cfg_attr(dash_lints, register_tool(dash_lints))]
#![warn(clippy::redundant_clone)]
#![warn(clippy::redundant_clone, unused_qualifications)]
#![deny(clippy::disallowed_methods)]

use std::ops::RangeBounds;
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_vm/src/value/function/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl Object for ThenTask {

fn apply(
&self,
scope: &mut crate::localscope::LocalScope,
scope: &mut LocalScope,
_callee: ObjectId,
_this: This,
args: Vec<Value>,
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_vm/src/value/function/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ unsafe impl Trace for FunctionKind {
}
}

impl fmt::Debug for FunctionKind {
impl Debug for FunctionKind {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::Native(..) => f.write_str("NativeFunction"),
Expand Down
46 changes: 17 additions & 29 deletions crates/dash_vm/src/value/promise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,32 +78,28 @@ impl Object for Promise {

fn set_property(
&self,
sc: &mut crate::localscope::LocalScope,
sc: &mut LocalScope,
key: crate::value::object::PropertyKey,
value: crate::value::object::PropertyValue,
) -> Result<(), Value> {
self.obj.set_property(sc, key, value)
}

fn delete_property(
&self,
sc: &mut crate::localscope::LocalScope,
key: crate::value::object::PropertyKey,
) -> Result<Unrooted, Value> {
fn delete_property(&self, sc: &mut LocalScope, key: crate::value::object::PropertyKey) -> Result<Unrooted, Value> {
self.obj.delete_property(sc, key)
}

fn set_prototype(&self, sc: &mut crate::localscope::LocalScope, value: Value) -> Result<(), Value> {
fn set_prototype(&self, sc: &mut LocalScope, value: Value) -> Result<(), Value> {
self.obj.set_prototype(sc, value)
}

fn get_prototype(&self, sc: &mut crate::localscope::LocalScope) -> Result<Value, Value> {
fn get_prototype(&self, sc: &mut LocalScope) -> Result<Value, Value> {
self.obj.get_prototype(sc)
}

fn apply(
&self,
scope: &mut crate::localscope::LocalScope,
scope: &mut LocalScope,
callee: ObjectId,
this: This,
args: Vec<Value>,
Expand Down Expand Up @@ -144,32 +140,28 @@ impl Object for PromiseResolver {

fn set_property(
&self,
sc: &mut crate::localscope::LocalScope,
sc: &mut LocalScope,
key: crate::value::object::PropertyKey,
value: crate::value::object::PropertyValue,
) -> Result<(), Value> {
self.obj.set_property(sc, key, value)
}

fn delete_property(
&self,
sc: &mut crate::localscope::LocalScope,
key: crate::value::object::PropertyKey,
) -> Result<Unrooted, Value> {
fn delete_property(&self, sc: &mut LocalScope, key: crate::value::object::PropertyKey) -> Result<Unrooted, Value> {
self.obj.delete_property(sc, key)
}

fn set_prototype(&self, sc: &mut crate::localscope::LocalScope, value: Value) -> Result<(), Value> {
fn set_prototype(&self, sc: &mut LocalScope, value: Value) -> Result<(), Value> {
self.obj.set_prototype(sc, value)
}

fn get_prototype(&self, sc: &mut crate::localscope::LocalScope) -> Result<Value, Value> {
fn get_prototype(&self, sc: &mut LocalScope) -> Result<Value, Value> {
self.obj.get_prototype(sc)
}

fn apply(
&self,
scope: &mut crate::localscope::LocalScope,
scope: &mut LocalScope,
_callee: ObjectId,
_this: This,
args: Vec<Value>,
Expand All @@ -187,7 +179,7 @@ impl Object for PromiseResolver {
self.obj.own_keys(sc)
}

fn type_of(&self, _: &Vm) -> super::Typeof {
fn type_of(&self, _: &Vm) -> Typeof {
Typeof::Function
}

Expand Down Expand Up @@ -220,32 +212,28 @@ impl Object for PromiseRejecter {

fn set_property(
&self,
sc: &mut crate::localscope::LocalScope,
sc: &mut LocalScope,
key: crate::value::object::PropertyKey,
value: crate::value::object::PropertyValue,
) -> Result<(), Value> {
self.obj.set_property(sc, key, value)
}

fn delete_property(
&self,
sc: &mut crate::localscope::LocalScope,
key: crate::value::object::PropertyKey,
) -> Result<Unrooted, Value> {
fn delete_property(&self, sc: &mut LocalScope, key: crate::value::object::PropertyKey) -> Result<Unrooted, Value> {
self.obj.delete_property(sc, key)
}

fn set_prototype(&self, sc: &mut crate::localscope::LocalScope, value: Value) -> Result<(), Value> {
fn set_prototype(&self, sc: &mut LocalScope, value: Value) -> Result<(), Value> {
self.obj.set_prototype(sc, value)
}

fn get_prototype(&self, sc: &mut crate::localscope::LocalScope) -> Result<Value, Value> {
fn get_prototype(&self, sc: &mut LocalScope) -> Result<Value, Value> {
self.obj.get_prototype(sc)
}

fn apply(
&self,
scope: &mut crate::localscope::LocalScope,
scope: &mut LocalScope,
_callee: ObjectId,
_this: This,
args: Vec<Value>,
Expand All @@ -263,7 +251,7 @@ impl Object for PromiseRejecter {
self.obj.own_keys(sc)
}

fn type_of(&self, _: &Vm) -> super::Typeof {
fn type_of(&self, _: &Vm) -> Typeof {
Typeof::Function
}

Expand Down
15 changes: 5 additions & 10 deletions crates/dash_vm/src/value/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ impl Object for JsString {
fn get_own_property_descriptor(
&self,
sc: &mut LocalScope,
key: super::object::PropertyKey,
) -> Result<Option<super::object::PropertyValue>, super::Unrooted> {
key: PropertyKey,
) -> Result<Option<PropertyValue>, Unrooted> {
if let PropertyKey::String(st) = key {
if st.sym() == sym::length {
return Ok(Some(PropertyValue::static_empty(Value::number(self.len(sc) as f64))));
Expand All @@ -96,16 +96,11 @@ impl Object for JsString {
Ok(None)
}

fn set_property(
&self,
_: &mut LocalScope,
_: super::object::PropertyKey,
_: super::object::PropertyValue,
) -> Result<(), Value> {
fn set_property(&self, _: &mut LocalScope, _: PropertyKey, _: PropertyValue) -> Result<(), Value> {
Ok(())
}

fn delete_property(&self, _: &mut LocalScope, _: super::object::PropertyKey) -> Result<super::Unrooted, Value> {
fn delete_property(&self, _: &mut LocalScope, _: PropertyKey) -> Result<Unrooted, Value> {
Ok(Unrooted::new(Value::undefined()))
}

Expand All @@ -123,7 +118,7 @@ impl Object for JsString {
_: crate::gc::ObjectId,
_: This,
_: Vec<Value>,
) -> Result<super::Unrooted, super::Unrooted> {
) -> Result<Unrooted, Unrooted> {
let v = self.res(scope).to_owned();
throw!(scope, TypeError, "'{}' is not a function", v)
}
Expand Down

0 comments on commit b708da9

Please sign in to comment.