chore: clear compiler warnings introduced by the Python host work

Drop two unneeded mut bindings in tests and mark the generated dict/enum
converters allow(dead_code), since a kind can leave one unused.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Felix RiestraandClaude Sonnet 5 committed 2026-09-21 18:31:23 +02:00
1 parent 8eb85dab8d
commit a25ae4f8c0
2 files changed
+5 -2

No files matched your search

+3
View File
@@ -587,6 +587,7 @@ fn gen_unit_enum(name: &str, info: &TypeInfo) -> String {
{name_arms} }}
}}
#[allow(dead_code)]
fn str_to_{snake}(value: String, vm: &VirtualMachine) -> PyResult<{path}> {{
match value.as_str() {{
{parse_arms} other => Err(vm.new_value_error(format!("ocs: unsupported {name} value: {{other}}"))),
@@ -656,6 +657,7 @@ fn gen_tagged_enum(name: &str, info: &TypeInfo, registry: &TypeRegistry) -> Stri
{to_arms} }}
}}
#[allow(dead_code)]
fn dict_to_{snake}(value: PyObjectRef, vm: &VirtualMachine) -> PyResult<{path}> {{
let dict = value.try_into_value::<rustpython_vm::builtins::PyDictRef>(vm)?;
let kind = dict.get_item("kind", vm)?.try_into_value::<String>(vm)?;
@@ -732,6 +734,7 @@ fn gen_struct(name: &str, info: &TypeInfo, registry: &TypeRegistry, required: &[
{to_dict_body} Ok(dict.into())
}}
#[allow(dead_code)]
fn dict_to_{snake}(value: PyObjectRef, vm: &VirtualMachine) -> PyResult<{path}> {{
let dict = value.try_into_value::<rustpython_vm::builtins::PyDictRef>(vm)?;
let allowed: &[&str] = &[{allowed_list}];
+2 -2
View File
@@ -7100,7 +7100,7 @@ mod tests {
let mut app = OpenCADStudio::new_for_test();
app.tabs[0].is_start = false;
let mut host = HostSession::new(&mut app, 0);
let mut object = |host: &mut HostSession<'_>, data: ClassObjectData| {
let object = |host: &mut HostSession<'_>, data: ClassObjectData| {
let handle = host.document_mut().allocate_handle();
let mut class_object = ClassObject::new(data);
class_object.handle = handle;
@@ -7340,7 +7340,7 @@ mod tests {
std::path::Path::new(&plugin_path), &mut host, crate::plugin::v4_support::notification_handler(),
).unwrap();
let dir = std::env::temp_dir();
let mut run = |host: &mut HostSession<'_>, tag: &str, body: &str| {
let run = |host: &mut HostSession<'_>, tag: &str, body: &str| {
let script = dir.join(format!("ocs_layers_{tag}_{}.py", std::process::id()));
std::fs::write(&script, format!(concat!(
"def P(x, y, z): return {{'x': x, 'y': y, 'z': z}}\n",