Upgrade rust/crates/structopt-derive to 0.4.13 am: fef3b76468

Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/structopt-derive/+/1478465

Change-Id: I8907780bb1af39174cb5dbcf18a3b0f97cae2d49
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index bb978e8..ae54c03 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
 {
   "git": {
-    "sha1": "ff542c67023cbddbb2198df4087abc6aa6c8d5b7"
+    "sha1": "6fa8d68298eab6b4eb94b4b40ce64992b20c7263"
   }
 }
diff --git a/Android.bp b/Android.bp
index 0c11915..627688f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -36,7 +36,7 @@
 //   proc-macro-error-attr-1.0.4
 //   proc-macro2-1.0.24 "default,proc-macro"
 //   quote-1.0.7 "default,proc-macro"
-//   syn-1.0.42 "clone-impls,default,derive,full,parsing,printing,proc-macro,quote"
+//   syn-1.0.48 "clone-impls,default,derive,full,parsing,printing,proc-macro,quote"
 //   unicode-segmentation-1.6.0
 //   unicode-xid-0.2.1 "default"
 //   version_check-0.9.2
diff --git a/Cargo.toml b/Cargo.toml
index 5afdc79..4f0f326 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
 [package]
 edition = "2018"
 name = "structopt-derive"
-version = "0.4.11"
+version = "0.4.13"
 authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
 description = "Parse command line argument by defining a struct, derive crate."
 documentation = "https://docs.rs/structopt-derive"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
old mode 100644
new mode 100755
index ff14f47..176b34a
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
 [package]
 name = "structopt-derive"
-version = "0.4.11"
+version = "0.4.13"
 edition = "2018"
 authors = ["Guillaume Pinot <texitoi@texitoi.eu>"]
 description = "Parse command line argument by defining a struct, derive crate."
diff --git a/LICENSE-APACHE b/LICENSE-APACHE
old mode 100644
new mode 100755
diff --git a/LICENSE-MIT b/LICENSE-MIT
old mode 100644
new mode 100755
diff --git a/METADATA b/METADATA
index b40e4df..18397ed 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/structopt-derive/structopt-derive-0.4.11.crate"
+    value: "https://static.crates.io/crates/structopt-derive/structopt-derive-0.4.13.crate"
   }
-  version: "0.4.11"
+  version: "0.4.13"
   license_type: NOTICE
   last_upgrade_date {
     year: 2020
     month: 10
-    day: 6
+    day: 28
   }
 }
diff --git a/src/attrs.rs b/src/attrs.rs
old mode 100644
new mode 100755
diff --git a/src/doc_comments.rs b/src/doc_comments.rs
old mode 100644
new mode 100755
diff --git a/src/lib.rs b/src/lib.rs
old mode 100644
new mode 100755
index 6cc415b..b99bd35
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,6 +11,8 @@
 //! for the usage of `#[derive(StructOpt)]`.
 
 #![allow(clippy::large_enum_variant)]
+// FIXME: remove when and if our MSRV hits 1.42
+#![allow(clippy::match_like_matches_macro)]
 #![forbid(unsafe_code)]
 
 extern crate proc_macro;
diff --git a/src/parse.rs b/src/parse.rs
old mode 100644
new mode 100755
diff --git a/src/spanned.rs b/src/spanned.rs
old mode 100644
new mode 100755
diff --git a/src/ty.rs b/src/ty.rs
old mode 100644
new mode 100755
index 89d8b00..ad3acd9
--- a/src/ty.rs
+++ b/src/ty.rs
@@ -63,6 +63,8 @@
 where
     F: FnOnce(&PathSegment) -> bool,
 {
+    let ty = strip_group(ty);
+
     only_last_segment(ty)
         .filter(|segment| f(segment))
         .and_then(|segment| {
@@ -85,6 +87,8 @@
 }
 
 pub fn is_simple_ty(ty: &syn::Type, name: &str) -> bool {
+    let ty = strip_group(ty);
+
     only_last_segment(ty)
         .map(|segment| {
             if let PathArguments::None = segment.arguments {
@@ -96,6 +100,23 @@
         .unwrap_or(false)
 }
 
+// If the struct is placed inside of a macro_rules! declaration,
+// in some circumstances, the tokens inside will be enclosed
+// in `proc_macro::Group` delimited by invisible `proc_macro::Delimiter::None`.
+//
+// In syn speak, this is encoded via `*::Group` variants. We don't really care about
+// that, so let's just strip it.
+//
+// Details: https://doc.rust-lang.org/proc_macro/enum.Delimiter.html#variant.None
+// See also: https://github.com/TeXitoi/structopt/issues/439
+fn strip_group(mut ty: &syn::Type) -> &syn::Type {
+    while let Type::Group(group) = ty {
+        ty = &*group.elem;
+    }
+
+    ty
+}
+
 fn is_generic_ty(ty: &syn::Type, name: &str) -> bool {
     subty_if_name(ty, name).is_some()
 }