Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clippy
  • Loading branch information
arihant2math committed Mar 24, 2025
commit aa2fa5f6fb100052ecfb91cf3ea21ba7425658ad
8 changes: 4 additions & 4 deletions vm/src/stdlib/ctypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,19 @@ pub(crate) mod _ctypes {
#[pyfunction]
fn byref(_args: FuncArgs, vm: &VirtualMachine) -> PyResult<()> {
// TODO: RUSTPYTHON
return Err(vm.new_value_error("not implemented".to_string()));
Err(vm.new_value_error("not implemented".to_string()))
}

#[pyfunction]
fn alignment(_args: FuncArgs, vm: &VirtualMachine) -> PyResult<()> {
// TODO: RUSTPYTHON
return Err(vm.new_value_error("not implemented".to_string()));
Err(vm.new_value_error("not implemented".to_string()))
}

#[pyfunction]
fn resize(_args: FuncArgs, vm: &VirtualMachine) -> PyResult<()> {
// TODO: RUSTPYTHON
return Err(vm.new_value_error("not implemented".to_string()));
Err(vm.new_value_error("not implemented".to_string()))
}

#[pyfunction]
Expand Down Expand Up @@ -312,6 +312,6 @@ pub(crate) mod _ctypes {
#[pyattr]
fn _cast_addr(_vm: &VirtualMachine) -> usize {
// TODO: RUSTPYTHON
return 0;
0
}
}
4 changes: 2 additions & 2 deletions vm/src/stdlib/ctypes/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl Callable for PyCArrayType {
length: AtomicCell::new(zelf.inner.length.load()),
value: PyRwLock::new(zelf.inner.value.read().clone()),
}
.into_pyobject(&vm))
.into_pyobject(vm))
}
}

Expand Down Expand Up @@ -70,7 +70,7 @@ impl Constructor for PyCArray {
length: AtomicCell::new(args.1),
value: PyRwLock::new(vm.ctx.none()),
}
.into_pyobject(&vm))
.into_pyobject(vm))
}
}

Expand Down
16 changes: 7 additions & 9 deletions vm/src/stdlib/ctypes/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ impl Function {
let converted = ffi_type_from_str(&arg._type_);
return match converted {
Some(t) => Ok(t),
None => Err(vm.new_type_error(format!(
"Invalid type" // TODO: add type name
))),
None => Err(vm.new_type_error("Invalid type".to_string())), // TODO: add type name
};
}
if let Some(arg) = arg.payload_if_subclass::<PyCArray>(vm) {
Expand All @@ -65,15 +63,13 @@ impl Function {
})?
.to_string();
let converted = ffi_type_from_str(&ty_str);
return match converted {
match converted {
Some(_t) => {
// TODO: Use
Ok(Type::void())
}
None => Err(vm.new_type_error(format!(
"Invalid type" // TODO: add type name
))),
};
None => Err(vm.new_type_error("Invalid type".to_string())), // TODO: add type name
}
} else {
Err(vm.new_type_error("Expected a ctypes simple type".to_string()))
}
Expand Down Expand Up @@ -190,7 +186,9 @@ impl Callable for PyCFuncPtr {
let name = zelf.name.read();
let res_type = zelf._restype_.read();
let func = Function::load(
inner_lib.as_ref().unwrap(),
inner_lib.as_ref().ok_or_else(|| {
vm.new_value_error("Library not found".to_string())
})?,
&name,
&args.args,
&res_type,
Expand Down