chore: clippy

This commit is contained in:
2025-05-10 16:34:41 +08:00
parent f86c088e97
commit fa3193ea50
7 changed files with 8 additions and 11 deletions

View File

@@ -28,7 +28,7 @@ impl AttrSet {
}
pub fn push_attr(&mut self, sym: Symbol, val: Value) {
if let Some(_) = self.data.get_mut(&sym) {
if self.data.get_mut(&sym).is_some() {
todo!()
}
self.data.insert_mut(sym, val);
@@ -72,7 +72,7 @@ impl AttrSet {
.collect();
map.iter_mut()
.map(|(_, v)| v.force_deep(vm).map(|_| ()))
.find(|v| matches!(v, Err(_)))
.find(|v| v.is_err())
.map_or(Ok(()), |err| err)?;
self.data = map.into_iter().collect();
Ok(())
@@ -159,7 +159,7 @@ impl RecAttrSet {
.collect();
map.iter_mut()
.map(|(_, v)| v.force_deep(vm).map(|_| ()))
.find(|v| matches!(v, Err(_)))
.find(|v| v.is_err())
.map_or(Ok(()), |err| err)?;
*self.data.borrow_mut() = map.into_iter().collect();
Ok(())

View File

@@ -60,7 +60,7 @@ impl Func {
for (formal, default) in formals {
let arg = arg
.select(formal.clone().into())
.or_else(|| default.map(|thunk| Value::Thunk(thunk)))
.or_else(|| default.map(Value::Thunk))
.unwrap();
new.insert_mut(formal.into(), arg);
}

View File

@@ -34,7 +34,7 @@ impl List {
let mut vec: Vec<_> = self.data.iter().cloned().collect();
vec.iter_mut()
.map(|v| v.force_deep(vm).map(|_| ()))
.find(|v| matches!(v, Err(_)))
.find(|v| v.is_err())
.map_or(Ok(()), |err| err)?;
self.data = vec.into_iter().collect();
Ok(())

View File

@@ -25,7 +25,6 @@ pub use cnst::Const;
pub use func::*;
pub use list::List;
pub use primop::*;
pub use string::ContextfulString;
pub trait ToPublic {
fn to_public(self, vm: &VM) -> p::Value;
@@ -415,7 +414,6 @@ impl Value {
pub fn coerce_to_string(&mut self) -> &mut Self {
if let VmConst(Const::String(_)) = self {
()
} else {
todo!()
}