🔧 Fix all unused_mut warnings: 16 instances cleaned up
- Remove unnecessary 'mut' from variable declarations - Clean up code in boxes/, interpreter/, mir/, backend/, and runtime/ - No functional changes, just cleaner code
This commit is contained in:
@ -245,7 +245,7 @@ impl LLVMCompiler {
|
|||||||
|
|
||||||
// Pre-create allocas for locals on demand (entry-only builder)
|
// Pre-create allocas for locals on demand (entry-only builder)
|
||||||
let mut allocas: HashMap<ValueId, PointerValue> = HashMap::new();
|
let mut allocas: HashMap<ValueId, PointerValue> = HashMap::new();
|
||||||
let mut entry_builder = codegen.context.create_builder();
|
let entry_builder = codegen.context.create_builder();
|
||||||
entry_builder.position_at_end(entry_bb);
|
entry_builder.position_at_end(entry_bb);
|
||||||
|
|
||||||
// Helper: map MirType to LLVM basic type (value type)
|
// Helper: map MirType to LLVM basic type (value type)
|
||||||
@ -807,7 +807,7 @@ impl LLVMCompiler {
|
|||||||
let mut a2 = i64t.const_zero();
|
let mut a2 = i64t.const_zero();
|
||||||
let mut a3 = i64t.const_zero();
|
let mut a3 = i64t.const_zero();
|
||||||
let mut a4 = i64t.const_zero();
|
let mut a4 = i64t.const_zero();
|
||||||
let mut get_i64 =
|
let get_i64 =
|
||||||
|vid: ValueId| -> Result<inkwell::values::IntValue, String> {
|
|vid: ValueId| -> Result<inkwell::values::IntValue, String> {
|
||||||
let v = *vmap.get(&vid).ok_or("arg missing")?;
|
let v = *vmap.get(&vid).ok_or("arg missing")?;
|
||||||
to_i64_any(codegen.context, &codegen.builder, v)
|
to_i64_any(codegen.context, &codegen.builder, v)
|
||||||
|
|||||||
@ -31,7 +31,7 @@ impl AotCompilerBox {
|
|||||||
Err(e) => return Box::new(StringBox::new(format!("ERR: current_exe(): {}", e)))
|
Err(e) => return Box::new(StringBox::new(format!("ERR: current_exe(): {}", e)))
|
||||||
};
|
};
|
||||||
// Propagate relevant envs (AOT/JIT observe)
|
// Propagate relevant envs (AOT/JIT observe)
|
||||||
let mut c = cmd.arg("--backend").arg("vm") // ensures runner path
|
let c = cmd.arg("--backend").arg("vm") // ensures runner path
|
||||||
.arg("--compile-native")
|
.arg("--compile-native")
|
||||||
.arg("-o").arg(out)
|
.arg("-o").arg(out)
|
||||||
.arg(file)
|
.arg(file)
|
||||||
|
|||||||
@ -108,7 +108,7 @@ impl P2PBox {
|
|||||||
// Create transport and attach receive callback before boxing
|
// Create transport and attach receive callback before boxing
|
||||||
let (transport_boxed, attach_cb): (Box<dyn Transport>, bool) = match transport_kind {
|
let (transport_boxed, attach_cb): (Box<dyn Transport>, bool) = match transport_kind {
|
||||||
TransportKind::InProcess => {
|
TransportKind::InProcess => {
|
||||||
let mut t = InProcessTransport::new(node_id.clone());
|
let t = InProcessTransport::new(node_id.clone());
|
||||||
// We'll attach callback below after P2PBox struct is created
|
// We'll attach callback below after P2PBox struct is created
|
||||||
(Box::new(t), true)
|
(Box::new(t), true)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -215,7 +215,7 @@ impl SocketBox {
|
|||||||
if ms == 0 { return self.accept(); }
|
if ms == 0 { return self.accept(); }
|
||||||
|
|
||||||
let start = std::time::Instant::now();
|
let start = std::time::Instant::now();
|
||||||
if let Ok(mut guard) = self.listener.write() {
|
if let Ok(guard) = self.listener.write() {
|
||||||
if let Some(ref listener) = *guard {
|
if let Some(ref listener) = *guard {
|
||||||
let _ = listener.set_nonblocking(true);
|
let _ = listener.set_nonblocking(true);
|
||||||
loop {
|
loop {
|
||||||
@ -319,7 +319,7 @@ impl SocketBox {
|
|||||||
let stream_guard = self.stream.write().unwrap();
|
let stream_guard = self.stream.write().unwrap();
|
||||||
if let Some(ref stream) = *stream_guard {
|
if let Some(ref stream) = *stream_guard {
|
||||||
match stream.try_clone() {
|
match stream.try_clone() {
|
||||||
Ok(mut stream_clone) => {
|
Ok(stream_clone) => {
|
||||||
drop(stream_guard);
|
drop(stream_guard);
|
||||||
let _ = stream_clone.set_read_timeout(Some(Duration::from_millis(ms)));
|
let _ = stream_clone.set_read_timeout(Some(Duration::from_millis(ms)));
|
||||||
let mut reader = BufReader::new(stream_clone);
|
let mut reader = BufReader::new(stream_clone);
|
||||||
|
|||||||
@ -98,7 +98,7 @@ impl NyashInterpreter {
|
|||||||
reg.register(udf);
|
reg.register(udf);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut this = Self {
|
let this = Self {
|
||||||
shared,
|
shared,
|
||||||
local_vars: HashMap::new(),
|
local_vars: HashMap::new(),
|
||||||
outbox_vars: HashMap::new(),
|
outbox_vars: HashMap::new(),
|
||||||
@ -168,7 +168,7 @@ impl NyashInterpreter {
|
|||||||
reg.register(udf);
|
reg.register(udf);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut this = Self {
|
let this = Self {
|
||||||
shared,
|
shared,
|
||||||
local_vars: HashMap::new(),
|
local_vars: HashMap::new(),
|
||||||
outbox_vars: HashMap::new(),
|
outbox_vars: HashMap::new(),
|
||||||
|
|||||||
@ -102,7 +102,7 @@ impl NyashInterpreter {
|
|||||||
let mut all_methods = HashMap::new();
|
let mut all_methods = HashMap::new();
|
||||||
for parent_name in &box_decl.extends {
|
for parent_name in &box_decl.extends {
|
||||||
use crate::box_trait::is_builtin_box;
|
use crate::box_trait::is_builtin_box;
|
||||||
let mut is_builtin = is_builtin_box(parent_name);
|
let is_builtin = is_builtin_box(parent_name);
|
||||||
#[cfg(all(feature = "gui", not(target_arch = "wasm32")))]
|
#[cfg(all(feature = "gui", not(target_arch = "wasm32")))]
|
||||||
{
|
{
|
||||||
if parent_name == "EguiBox" { is_builtin = true; }
|
if parent_name == "EguiBox" { is_builtin = true; }
|
||||||
|
|||||||
@ -137,7 +137,7 @@ impl super::MirBuilder {
|
|||||||
// does not assign the same variable, bind that variable to a Phi of (then_value, pre_if_value).
|
// does not assign the same variable, bind that variable to a Phi of (then_value, pre_if_value).
|
||||||
let assigned_var_then = extract_assigned_var(&then_ast_for_analysis);
|
let assigned_var_then = extract_assigned_var(&then_ast_for_analysis);
|
||||||
let assigned_var_else = else_ast_for_analysis.as_ref().and_then(|a| extract_assigned_var(a));
|
let assigned_var_else = else_ast_for_analysis.as_ref().and_then(|a| extract_assigned_var(a));
|
||||||
let mut result_val = self.value_gen.next();
|
let result_val = self.value_gen.next();
|
||||||
if let Some(var_name) = assigned_var_then.clone() {
|
if let Some(var_name) = assigned_var_then.clone() {
|
||||||
let else_assigns_same = assigned_var_else.as_ref().map(|s| s == &var_name).unwrap_or(false);
|
let else_assigns_same = assigned_var_else.as_ref().map(|s| s == &var_name).unwrap_or(false);
|
||||||
if !else_assigns_same {
|
if !else_assigns_same {
|
||||||
|
|||||||
@ -173,8 +173,8 @@ impl PluginLoaderV2 {
|
|||||||
let plugins = self.plugins.read().unwrap();
|
let plugins = self.plugins.read().unwrap();
|
||||||
let plugin = plugins.get(lib_name).ok_or(BidError::PluginError)?;
|
let plugin = plugins.get(lib_name).ok_or(BidError::PluginError)?;
|
||||||
let type_id = if let Some(spec) = self.box_specs.read().unwrap().get(&(lib_name.to_string(), box_type.to_string())) { spec.type_id.unwrap_or_else(|| config.box_types.get(box_type).copied().unwrap_or(0)) } else { let box_conf = config.get_box_config(lib_name, box_type, &toml_value).ok_or(BidError::InvalidType)?; box_conf.type_id };
|
let type_id = if let Some(spec) = self.box_specs.read().unwrap().get(&(lib_name.to_string(), box_type.to_string())) { spec.type_id.unwrap_or_else(|| config.box_types.get(box_type).copied().unwrap_or(0)) } else { let box_conf = config.get_box_config(lib_name, box_type, &toml_value).ok_or(BidError::InvalidType)?; box_conf.type_id };
|
||||||
let mut out = vec![0u8; 1024];
|
let out = vec![0u8; 1024];
|
||||||
let mut out_len = out.len();
|
let out_len = out.len();
|
||||||
let tlv_args = crate::runtime::plugin_ffi_common::encode_empty_args();
|
let tlv_args = crate::runtime::plugin_ffi_common::encode_empty_args();
|
||||||
let (birth_result, _len, out_vec) = super::host_bridge::invoke_alloc(plugin.invoke_fn, type_id, 0, 0, &tlv_args);
|
let (birth_result, _len, out_vec) = super::host_bridge::invoke_alloc(plugin.invoke_fn, type_id, 0, 0, &tlv_args);
|
||||||
let out = out_vec;
|
let out = out_vec;
|
||||||
|
|||||||
Reference in New Issue
Block a user