Repository: aptos-labs/aptos-core
File: aptos-move/aptos-release-builder/src/components/framework.rs (Rust)

Code before:
    // NOTE: This is skipping 0x7 (aptos-experimental package) which is only meant to be released
    // to devnet (or local testnet) via the genesis process and never released/upgraded in testnet
    // or mainnet.

    // Define all available packages with their metadata
    let all_packages = [
        ("0x1", "aptos-move/framework/move-stdlib", "move-stdlib"),
        ("0x1", "aptos-move/framework/aptos-stdlib", "aptos-stdlib"),
        (
            "0x1",
            "aptos-move/framework/aptos-framework",
            "aptos-framework",
        ),
        ("0x3", "aptos-move/framework/aptos-token", "aptos-token"),
        (
            "0x4",
            "aptos-move/framework/aptos-token-objects",
            "aptos-token-objects",
        ),
        ("0x5", "aptos-move/framework/aptos-trading", "aptos-trading"),
    ];

    // Filter packages if specific ones are requested
    let mut package_path_list: Vec<(&str, &str)> =
        if let Some(requested_packages) = &config.packages {
            if requested_packages.is_empty() {
                // If packages field exists but is empty, include all packages
                all_packages
                    .iter()
                    .map(|(addr, path, _)| (*addr, *path))
                    .collect()
            } else {
                // Filter to only requested packages
                all_packages
                    .iter()
                    .filter(|(_, _, name)| requested_packages.contains(&name.to_string()))
                    .map(|(addr, path, _)| (*addr, *path))
                    .collect()
            }
        } else {
            // If packages field is None, include all packages (default behavior)
            all_packages
                .iter()
                .map(|(addr, path, _)| (*addr, *path))
                .collect()
        };

    let mut result: Vec<(String, String)> = vec![];

    let temp_root_path = TempPath::new();
    temp_root_path.create_as_dir()?;

Review comment (refactor):
nit: 
```
match &config.packages {
  None | Some(requested_packages) if requested_packages.is_empty() => { ... },
  Some(requested_packages) => { ... },
}
```
to not duplicate code

Code after:

    // NOTE: This is skipping 0x7 (aptos-experimental package) which is only meant to be released
    // to devnet (or local testnet) via the genesis process and never released/upgraded in testnet
    // or mainnet.

    // Define all available packages with their metadata
    let all_packages = [
        ("0x1", "aptos-move/framework/move-stdlib", "move-stdlib"),
        ("0x1", "aptos-move/framework/aptos-stdlib", "aptos-stdlib"),
        (
            "0x1",
            "aptos-move/framework/aptos-framework",
            "aptos-framework",
        ),
        ("0x3", "aptos-move/framework/aptos-token", "aptos-token"),
        (
            "0x4",
            "aptos-move/framework/aptos-token-objects",
            "aptos-token-objects",
        ),
        ("0x5", "aptos-move/framework/aptos-trading", "aptos-trading"),
    ];

    // Filter packages if specific ones are requested
    let mut package_path_list: Vec<(&str, &str)> =
        if let Some(requested_packages) = &config.packages {
            if requested_packages.is_empty() {
                // If packages field exists but is empty, include all packages
                all_packages
                    .iter()
                    .map(|(addr, path, _)| (*addr, *path))
                    .collect()
            } else {
                // Validate that the requested packages are valid
                let all_package_names = all_packages
                    .iter()
                    .map(|(_, _, name)| name.to_string())
                    .collect::<HashSet<String>>();
                for package in requested_packages {
                    if !all_package_names.contains(package) {
                        return Err(anyhow::anyhow!(
                            "Invalid package name specified: {}, must be one of: {:?}",
                            package,
                            all_package_names
                        ));
                    }
                }

                // Filter to only requested packages
                all_packages
                    .iter()