You are an expert Rust programmer. You are given the following function:

#[derive(Debug, PartialEq, Eq, Hash)]
pub enum FivePrimeStatus {
    // 5' mapping
    Complete,
    CompleteWithIR,
    TruncatedInExon,
    TruncatedInExonIR,
}

pub fn map_5_prime(
    c_fivends: &[(u64, u64)],
    c_exons: &[(u64, u64)],
    c_introns: &[(u64, u64)],
    tx_exons: &[&(u64, u64)],
    id: &Arc<str>,
    // flags -> (skip_exon [0: true, 1: false], nt_5_end)
    flags: &HashSet<(u64, u64)>,
    line: String,
) -> Result<(String, String, Status)> {
    let mut status = FivePrimeStatus::Complete;
    let mut idx = String::new();
    let exon = tx_exons[0];
    let (skip, _) = flags.iter().next().unwrap();

    //     println!("{:?} - {:?} - {:?}", exon, c_exons, id);

    for (i, fend) in c_fivends.iter().enumerate() {
        if exon.0 > fend.1 || exon.1 < fend.0 {
            if i == c_fivends.len() - 1 {
                // exon is after the last fivend
                for (j, c_exon) in c_exons.iter().enumerate() {
                    if exon.0 > c_exon.0 && exon.0 < c_exon.1 {
                        if c_fivends.contains(&c_exon) && *skip < 1 {
                            status = FivePrimeStatus::Complete;
                            idx = i.to_string();
                            break;
                        } else {
                            status = FivePrimeStatus::TruncatedInExon;
                            idx = i.to_string();
                            break;
                        }
                    } else {
                        status = FivePrimeStatus::Complete;
                        continue;
                    }
                }
                break;
            } else {
                continue;
            }
        } else {
            // most likely inside the exon
            // starts are equal -> Complete
            // starts differ -> check if intron is preserved
            if exon.0 == fend.0 {
                // starts are equal
                // check if intron is preserved -> ask Michael
                status = FivePrimeStatus::Complete;
                idx = i.to_string();
                break;
            } else if exon.0 > fend.0 {
                // starts differ, eval skip flag + truncation
                // to eval truncation -> check if intron is preserved
                if *skip > 0 {
                    // not ignore this exon
                    // should evaluate nt_5_end here
                    status = FivePrimeStatus::TruncatedInExon;
                    idx = i.to_string();
                    break;
                } else {
                    // even if --ignore-exon is set, we need to check
                    // if the 5'end truncates any other consensus exon
                    for (j, c_exon) in c_exons.iter().enumerate() {
                        if exon.0 > c_exon.0 && exon.0 < c_exon.1 {
                            if c_fivends.contains(&c_exon) && *skip < 1 {
                                status = FivePrimeStatus::Complete;
                                idx = i.to_string();
                                break;
                            } else {
                                status = FivePrimeStatus::TruncatedInExon;
                                idx = i.to_string();
                                break;
                            }
                        } else {
                            status = FivePrimeStatus::Complete;
                            continue;
                        }
                    }

                    // ignore this exon -> still check intron
                    // loop through introns and check if this
                    // exon overlaps anyone
                    if status == FivePrimeStatus::Complete {
                        for c_intron in c_introns.iter() {
                            if exon.1 < c_intron.0 {
                                status = FivePrimeStatus::Complete;
                                break;
                            } else if exon.0 <= c_intron.0 && exon.1 >= c_intron.1 {
                                // retains an intron
                                status = FivePrimeStatus::CompleteWithIR;
                                idx = i.to_string();
                                break;
                            } else {
                                status = FivePrimeStatus::Complete;
                                idx = i.to_string();
                                continue;
                            }
                        }
                        break;
                    }
                }
            } else {
                for (j, c_exon) in c_exons.iter().enumerate() {
                    if exon.0 > c_exon.0 && exon.0 < c_exon.1 {
                        if c_fivends.contains(&c_exon) && *skip < 1 {
                            status = FivePrimeStatus::Complete;
                            idx = i.to_string();
                            break;
                        } else {
                            status = FivePrimeStatus::TruncatedInExon;
                            idx = i.to_string();
                            break;
                        }
                    } else {
                        status = FivePrimeStatus::Complete;
                        continue;
                    }
                }
            }
        }
    }

    let info = match status {
        FivePrimeStatus::Complete => (line, "".to_string(), Status::Complete),
        FivePrimeStatus::CompleteWithIR => {
            let new_id = format!("{}_5COMP_IR", id);
            let mut fields: Vec<&str> = line.split('\t').collect();
            fields[3] = &new_id;
            let line = fields.join("\t");

            (line, "".to_string(), Status::Complete)
        }
        FivePrimeStatus::TruncatedInExon => {
            let new_id = format!("{}_5TRUNC", id);
            let mut fields: Vec<&str> = line.split('\t').collect();
            fields[3] = &new_id;
            let line = fields.join("\t");

            (line, "".to_string(), Status::Truncated)
        }
        FivePrimeStatus::TruncatedInExonIR => {
            let new_id = format!("{}_5TRUNC_IR", id);
            let mut fields: Vec<&str> = line.split('\t').collect();
            fields[3] = &new_id;
            let line = fields.join("\t");

            (line, "".to_string(), Status::Truncated)
        }
    };

    Ok(info)
}

Your task is to improve its efficiency, making it faster, elegant and efficient. Be careful to change its current functionality. If this function produces different results than the achieved with this implementation you will die. Provide the code.