Remove slow_extend codepath
diff --git a/build.rs b/build.rs
index 771ca43..2689473 100644
--- a/build.rs
+++ b/build.rs
@@ -14,11 +14,6 @@
// procmacro2_semver_exempt surface area is implemented by using the
// nightly-only proc_macro API.
//
-// "slow_extend"
-// Fallback when `impl Extend for TokenStream` is not available. These impls
-// were added one version later than the rest of the proc_macro token API.
-// Enabled on rustc 1.29 only.
-//
// "proc_macro_span"
// Enable non-dummy behavior of Span::start and Span::end methods which
// requires an unstable compiler feature. Enabled when building with
@@ -70,10 +65,6 @@
println!("cargo:rustc-cfg=wrap_proc_macro");
}
- if version.minor == 29 {
- println!("cargo:rustc-cfg=slow_extend");
- }
-
if version.nightly && feature_allowed("proc_macro_span") {
println!("cargo:rustc-cfg=proc_macro_span");
}
diff --git a/src/wrapper.rs b/src/wrapper.rs
index 695fef1..36b75eb 100644
--- a/src/wrapper.rs
+++ b/src/wrapper.rs
@@ -200,17 +200,6 @@
fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self {
let mut streams = streams.into_iter();
match streams.next() {
- #[cfg(slow_extend)]
- Some(TokenStream::Compiler(first)) => {
- let stream = iter::once(first)
- .chain(streams.map(|s| match s {
- TokenStream::Compiler(s) => s,
- TokenStream::Fallback(_) => mismatch(),
- }))
- .collect();
- TokenStream::Compiler(stream)
- }
- #[cfg(not(slow_extend))]
Some(TokenStream::Compiler(mut first)) => {
first.extend(streams.map(|s| match s {
TokenStream::Compiler(s) => s,
@@ -234,27 +223,11 @@
fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, streams: I) {
match self {
TokenStream::Compiler(tts) => {
- #[cfg(not(slow_extend))]
- {
- tts.extend(
- streams
- .into_iter()
- .map(|t| TokenStream::from(t).unwrap_nightly()),
- );
- }
- #[cfg(slow_extend)]
- {
- *tts =
- tts.clone()
- .into_iter()
- .chain(streams.into_iter().map(TokenStream::from).flat_map(
- |t| match t {
- TokenStream::Compiler(tts) => tts.into_iter(),
- _ => mismatch(),
- },
- ))
- .collect();
- }
+ tts.extend(
+ streams
+ .into_iter()
+ .map(|t| TokenStream::from(t).unwrap_nightly()),
+ );
}
TokenStream::Fallback(tts) => tts.extend(streams),
}