openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

useless if statements in app/src-tauri/build.rs

Open EwenSellitto opened this issue 6 months ago • 0 comments

Summary

Just noticed two redundant if statements in app/src-tauri/build.rs. It’s not a big deal, but I wanted to point it out anyway! :)

Problem / Context

2 if not need in the builder file

fn maybe_override_tauri_config_for_local_builds() {
    let profile = env::var("PROFILE").unwrap_or_default();
    let skip_resources = env::var("TAURI_SKIP_RESOURCES").is_ok() || profile != "release";

    if !skip_resources {
        return;
    }
    // skip_resources is always true here

    let mut merge_config = serde_json::json!({});
    // HERE
    if skip_resources { 
        merge_config["bundle"]["resources"] = serde_json::json!([]);

    }

    match serde_json::to_string(&merge_config) {
        Ok(json) => {
            env::set_var("TAURI_CONFIG", json);
             // HERE
            if skip_resources {
                println!("cargo:warning=TAURI resources disabled for local build");
            }
        }
        Err(err) => {
            println!("cargo:warning=Failed to serialize TAURI_CONFIG override: {err}");
        }
    }
}

Acceptance criteria

  • [ ] Remove the ifs

EwenSellitto avatar May 14 '26 14:05 EwenSellitto