Snap for 7256110 from c93282a9e490317571f250916b717b2279b7c2da to sc-release

Change-Id: If7522348434a9f5599f04ee45737ccdf8cd185d5
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 5163423..bd3aebb 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
 {
   "git": {
-    "sha1": "3eb762421182b53411e58ff93765b5604ed89c8b"
+    "sha1": "b38636e38862f1df2c7b167073b022fcc8819a05"
   }
 }
diff --git a/.clippy.toml b/.clippy.toml
new file mode 100644
index 0000000..3d30690
--- /dev/null
+++ b/.clippy.toml
@@ -0,0 +1 @@
+msrv = "1.31.0"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4412b64..dc09e20 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -43,4 +43,4 @@
     steps:
       - uses: actions/checkout@v2
       - uses: dtolnay/rust-toolchain@clippy
-      - run: cargo clippy -- -Dclippy::all
+      - run: cargo clippy -- -Dclippy::all -Dclippy::pedantic
diff --git a/Android.bp b/Android.bp
index 3b05d9b..1c0a8b7 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,5 @@
 // This file is generated by cargo2android.py --run --dependencies.
+// Do not modify this file as changes will be overridden on upgrade.
 
 package {
     default_applicable_licenses: ["external_rust_crates_paste_license"],
diff --git a/Cargo.toml b/Cargo.toml
index 299dca1..1c2d8de 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
 [package]
 edition = "2018"
 name = "paste"
-version = "1.0.4"
+version = "1.0.5"
 authors = ["David Tolnay <dtolnay@gmail.com>"]
 description = "Macros for all your token pasting needs"
 readme = "README.md"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index ec7baa1..782f2f4 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
 [package]
 name = "paste"
-version = "1.0.4"
+version = "1.0.5"
 authors = ["David Tolnay <dtolnay@gmail.com>"]
 edition = "2018"
 license = "MIT OR Apache-2.0"
diff --git a/METADATA b/METADATA
index 6f124d0..d689809 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/paste/paste-1.0.4.crate"
+    value: "https://static.crates.io/crates/paste/paste-1.0.5.crate"
   }
-  version: "1.0.4"
+  version: "1.0.5"
   license_type: NOTICE
   last_upgrade_date {
-    year: 2020
-    month: 12
-    day: 9
+    year: 2021
+    month: 4
+    day: 1
   }
 }
diff --git a/README.md b/README.md
index 19fa99b..6faed11 100644
--- a/README.md
+++ b/README.md
@@ -134,6 +134,8 @@
     };
 }
 
+pub struct Paste {}
+
 method_new!(Paste);  // expands to #[doc = "Create a new `Paste` object"]
 ```
 
diff --git a/src/attr.rs b/src/attr.rs
index be64a79..8626d11 100644
--- a/src/attr.rs
+++ b/src/attr.rs
@@ -63,7 +63,7 @@
     let mut group_contains_paste = false;
     let mut expanded = TokenStream::new();
     let mut nested_attr = TokenStream::new();
-    for tt in group.stream().into_iter() {
+    for tt in group.stream() {
         match &tt {
             TokenTree::Punct(punct) if punct.as_char() == ',' => {
                 expanded.extend(expand_attr(
diff --git a/src/lib.rs b/src/lib.rs
index 794ef3b..d066ca0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -132,11 +132,17 @@
 //!     };
 //! }
 //!
-//! # struct Paste;
+//! pub struct Paste {}
+//!
 //! method_new!(Paste);  // expands to #[doc = "Create a new `Paste` object"]
 //! ```
 
-#![allow(clippy::needless_doctest_main)]
+#![allow(
+    clippy::doc_markdown,
+    clippy::module_name_repetitions,
+    clippy::needless_doctest_main,
+    clippy::too_many_lines
+)]
 
 extern crate proc_macro;
 
@@ -154,7 +160,8 @@
 #[proc_macro]
 pub fn paste(input: TokenStream) -> TokenStream {
     let mut contains_paste = false;
-    match expand(input, &mut contains_paste) {
+    let flatten_single_interpolation = true;
+    match expand(input, &mut contains_paste, flatten_single_interpolation) {
         Ok(expanded) => expanded,
         Err(err) => err.to_compile_error(),
     }
@@ -172,7 +179,11 @@
     paste(input)
 }
 
-fn expand(input: TokenStream, contains_paste: &mut bool) -> Result<TokenStream> {
+fn expand(
+    input: TokenStream,
+    contains_paste: &mut bool,
+    flatten_single_interpolation: bool,
+) -> Result<TokenStream> {
     let mut expanded = TokenStream::new();
     let mut lookbehind = Lookbehind::Other;
     let mut prev_none_group = None::<Group>;
@@ -203,15 +214,22 @@
                     let tokens = pasted_to_tokens(pasted, span)?;
                     expanded.extend(tokens);
                     *contains_paste = true;
-                } else if delimiter == Delimiter::None && is_flat_group(&content) {
+                } else if flatten_single_interpolation
+                    && delimiter == Delimiter::None
+                    && is_single_interpolation_group(&content)
+                {
                     expanded.extend(content);
                     *contains_paste = true;
                 } else {
                     let mut group_contains_paste = false;
-                    let mut nested = expand(content, &mut group_contains_paste)?;
-                    if delimiter == Delimiter::Bracket
-                        && (lookbehind == Lookbehind::Pound || lookbehind == Lookbehind::PoundBang)
-                    {
+                    let is_attribute = delimiter == Delimiter::Bracket
+                        && (lookbehind == Lookbehind::Pound || lookbehind == Lookbehind::PoundBang);
+                    let mut nested = expand(
+                        content,
+                        &mut group_contains_paste,
+                        flatten_single_interpolation && !is_attribute,
+                    )?;
+                    if is_attribute {
                         nested = expand_attr(nested, span, &mut group_contains_paste)?
                     }
                     let group = if group_contains_paste {
@@ -262,7 +280,7 @@
 }
 
 // https://github.com/dtolnay/paste/issues/26
-fn is_flat_group(input: &TokenStream) -> bool {
+fn is_single_interpolation_group(input: &TokenStream) -> bool {
     #[derive(PartialEq)]
     enum State {
         Init,
diff --git a/tests/test_doc.rs b/tests/test_doc.rs
index 1ceaf23..2e2b14d 100644
--- a/tests/test_doc.rs
+++ b/tests/test_doc.rs
@@ -52,3 +52,26 @@
     let expected = "HTTP GET!";
     assert_eq!(doc, expected);
 }
+
+// https://github.com/dtolnay/paste/issues/63
+#[test]
+fn test_stringify() {
+    macro_rules! create {
+        ($doc:expr) => {
+            paste! {
+                #[doc = $doc]
+                pub struct Struct;
+            }
+        };
+    }
+
+    macro_rules! forward {
+        ($name:ident) => {
+            create!(stringify!($name));
+        };
+    }
+
+    forward!(documentation);
+
+    let _ = Struct;
+}