// Iterators of Code 2026 — Day 19: Task Labels // Challenge: Replace the nested loops with one iterator pipeline. // Expand each project's tasks into "project/task" labels in input order. // Projects without tasks contribute nothing; repeated tasks stay repeated. fn task_labels(projects: &[(&str, &[&str])]) -> Vec { let mut labels = Vec::new(); for (project, tasks) in projects { for task in *tasks { labels.push(format!("{project}/{task}")); } } labels } fn main() { let projects: &[(&str, &[&str])] = &[ ("website", &["build", "deploy"]), ("archive", &[]), ("mobile", &["test"]), ]; assert_eq!( task_labels(projects), vec!["website/build", "website/deploy", "mobile/test"] ); assert!(task_labels(&[]).is_empty()); assert!(task_labels(&[("archive", &[])]).is_empty()); assert_eq!( task_labels(&[("api", &["test", "test"])]), vec!["api/test", "api/test"] ); }