patch_sync: Fix for Rust 1.55 compat, cli patch

On chrotomation, we still use Rust 1.55.
Rust 1.55 does not have the "from" implementation for arrays,
so we must build the BTrees by hand.

Additionally, this removes the requirement for having the
review strings be set.

BUG=b:209493133
TEST=cargo check

Change-Id: I6bc16e96cd56775c8c80667395f3dc3fb4857356
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3403387
Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
Reviewed-by: George Burgess <gbiv@chromium.org>
Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
diff --git a/llvm_tools/patch_sync/src/main.rs b/llvm_tools/patch_sync/src/main.rs
index 8c1eff1..033691e 100644
--- a/llvm_tools/patch_sync/src/main.rs
+++ b/llvm_tools/patch_sync/src/main.rs
@@ -37,13 +37,14 @@
             no_commit,
         } => transpose_subcmd(TransposeOpt {
             cros_checkout_path,
-            cros_reviewers: cros_reviewers.split(',').map(ToOwned::to_owned).collect(),
+            cros_reviewers: cros_reviewers
+                .map(|r| r.split(',').map(ToOwned::to_owned).collect())
+                .unwrap_or_default(),
             old_cros_ref,
             android_checkout_path,
             android_reviewers: android_reviewers
-                .split(',')
-                .map(ToOwned::to_owned)
-                .collect(),
+                .map(|r| r.split(',').map(ToOwned::to_owned).collect())
+                .unwrap_or_default(),
             old_android_ref,
             sync,
             verbose,
@@ -80,8 +81,11 @@
             parsed_collection
         } else {
             filter_patches_by_platform(&parsed_collection, platform).map_patches(|p| {
+                // Need to do this platforms creation as Rust 1.55 cannot use "from".
+                let mut platforms = BTreeSet::new();
+                platforms.insert(platform.to_string());
                 PatchDictSchema {
-                    platforms: BTreeSet::from([platform.to_string()]),
+                    platforms,
                     ..p.clone()
                 }
             })
@@ -230,7 +234,7 @@
         /// Emails to send review requests to during Chromium OS upload.
         /// Comma separated.
         #[structopt(long = "cros-rev")]
-        cros_reviewers: String,
+        cros_reviewers: Option<String>,
 
         /// Git ref (e.g. hash) for the ChromiumOS overlay to use as the base.
         #[structopt(long = "overlay-base-ref")]
@@ -243,7 +247,7 @@
         /// Emails to send review requests to during Android upload.
         /// Comma separated.
         #[structopt(long = "aosp-rev")]
-        android_reviewers: String,
+        android_reviewers: Option<String>,
 
         /// Git ref (e.g. hash) for the llvm_android repo to use as the base.
         #[structopt(long = "aosp-base-ref")]
diff --git a/llvm_tools/patch_sync/src/patch_parsing.rs b/llvm_tools/patch_sync/src/patch_parsing.rs
index 2f0fbc8..581b189 100644
--- a/llvm_tools/patch_sync/src/patch_parsing.rs
+++ b/llvm_tools/patch_sync/src/patch_parsing.rs
@@ -253,13 +253,13 @@
         let old_collection = old_collection.filter_patches(|p| old_collection.patch_exists(p));
         cur_collection.subtract(&old_collection)?
     };
-    let new_patches = new_patches.map_patches(|p| PatchDictSchema {
-        platforms: BTreeSet::from(["android".to_string(), "chromiumos".to_string()])
-            .union(&p.platforms)
-            .cloned()
-            .collect(),
-
-        ..p.to_owned()
+    let new_patches = new_patches.map_patches(|p| {
+        let mut platforms = BTreeSet::new();
+        platforms.extend(["android".to_string(), "chromiumos".to_string()]);
+        PatchDictSchema {
+            platforms: platforms.union(&p.platforms).cloned().collect(),
+            ..p.to_owned()
+        }
     });
     Ok((cur_collection, new_patches))
 }