🔧 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:
Selfhosting Dev
2025-09-11 16:34:22 +09:00
parent ba33431f02
commit faf79c5d52
8 changed files with 12 additions and 12 deletions

View File

@ -245,7 +245,7 @@ impl LLVMCompiler {
// Pre-create allocas for locals on demand (entry-only builder)
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);
// Helper: map MirType to LLVM basic type (value type)
@ -807,7 +807,7 @@ impl LLVMCompiler {
let mut a2 = i64t.const_zero();
let mut a3 = i64t.const_zero();
let mut a4 = i64t.const_zero();
let mut get_i64 =
let get_i64 =
|vid: ValueId| -> Result<inkwell::values::IntValue, String> {
let v = *vmap.get(&vid).ok_or("arg missing")?;
to_i64_any(codegen.context, &codegen.builder, v)

View File

@ -31,7 +31,7 @@ impl AotCompilerBox {
Err(e) => return Box::new(StringBox::new(format!("ERR: current_exe(): {}", e)))
};
// 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("-o").arg(out)
.arg(file)

View File

@ -108,7 +108,7 @@ impl P2PBox {
// Create transport and attach receive callback before boxing
let (transport_boxed, attach_cb): (Box<dyn Transport>, bool) = match transport_kind {
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
(Box::new(t), true)
}

View File

@ -215,7 +215,7 @@ impl SocketBox {
if ms == 0 { return self.accept(); }
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 {
let _ = listener.set_nonblocking(true);
loop {
@ -319,7 +319,7 @@ impl SocketBox {
let stream_guard = self.stream.write().unwrap();
if let Some(ref stream) = *stream_guard {
match stream.try_clone() {
Ok(mut stream_clone) => {
Ok(stream_clone) => {
drop(stream_guard);
let _ = stream_clone.set_read_timeout(Some(Duration::from_millis(ms)));
let mut reader = BufReader::new(stream_clone);

View File

@ -98,7 +98,7 @@ impl NyashInterpreter {
reg.register(udf);
}
let mut this = Self {
let this = Self {
shared,
local_vars: HashMap::new(),
outbox_vars: HashMap::new(),
@ -168,7 +168,7 @@ impl NyashInterpreter {
reg.register(udf);
}
let mut this = Self {
let this = Self {
shared,
local_vars: HashMap::new(),
outbox_vars: HashMap::new(),

View File

@ -102,7 +102,7 @@ impl NyashInterpreter {
let mut all_methods = HashMap::new();
for parent_name in &box_decl.extends {
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")))]
{
if parent_name == "EguiBox" { is_builtin = true; }

View File

@ -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).
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 mut result_val = self.value_gen.next();
let result_val = self.value_gen.next();
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);
if !else_assigns_same {

View File

@ -173,8 +173,8 @@ impl PluginLoaderV2 {
let plugins = self.plugins.read().unwrap();
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 mut out = vec![0u8; 1024];
let mut out_len = out.len();
let out = vec![0u8; 1024];
let out_len = out.len();
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 out = out_vec;