aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-15 21:45:39 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-15 21:45:39 +0000
commit6f4825e2ccd5a58941483516e9e5739020993a14 (patch)
treea9f5b49c1bcd5d7f11000a655eb7da788ef16208
parentbcab093dff5ad915c59786aa1e4f492e1b04125e (diff)
parent4b53745041c30d69b075a501e74cfb3a5ec6de1f (diff)
downloadsyn-aml_tz3_314012010.tar.gz
Change-Id: I47d13533a7f97551e6c4355bb37ad7b83bac8f43
-rw-r--r--.cargo_vcs_info.json7
-rw-r--r--Android.bp13
-rw-r--r--Cargo.toml19
-rw-r--r--Cargo.toml.orig10
-rw-r--r--METADATA10
-rw-r--r--README.md6
-rw-r--r--TEST_MAPPING155
-rw-r--r--benches/file.rs3
-rw-r--r--benches/rust.rs5
-rw-r--r--build.rs6
-rw-r--r--cargo2android.json5
-rw-r--r--src/attr.rs36
-rw-r--r--src/buffer.rs60
-rw-r--r--src/data.rs59
-rw-r--r--src/derive.rs20
-rw-r--r--src/discouraged.rs2
-rw-r--r--src/error.rs9
-rw-r--r--src/export.rs1
-rw-r--r--src/expr.rs108
-rw-r--r--src/gen/clone.rs10
-rw-r--r--src/gen/debug.rs2
-rw-r--r--src/gen/eq.rs417
-rw-r--r--src/gen/fold.rs591
-rw-r--r--src/gen/hash.rs17
-rw-r--r--src/gen/visit.rs1002
-rw-r--r--src/gen/visit_mut.rs992
-rw-r--r--src/generics.rs74
-rw-r--r--src/item.rs151
-rw-r--r--src/lib.rs15
-rw-r--r--src/lifetime.rs2
-rw-r--r--src/lit.rs112
-rw-r--r--src/parse_quote.rs42
-rw-r--r--src/pat.rs28
-rw-r--r--src/path.rs14
-rw-r--r--src/punctuated.rs14
-rw-r--r--src/stmt.rs91
-rw-r--r--src/ty.rs127
-rw-r--r--tests/common/eq.rs85
-rw-r--r--tests/common/mod.rs1
-rw-r--r--tests/debug/gen.rs67
-rw-r--r--tests/debug/mod.rs7
-rw-r--r--tests/macros/mod.rs12
-rw-r--r--tests/regression.rs5
-rw-r--r--tests/regression/issue1108.rs5
-rw-r--r--tests/repo/mod.rs53
-rw-r--r--tests/test_derive_input.rs2
-rw-r--r--tests/test_expr.rs18
-rw-r--r--tests/test_generics.rs2
-rw-r--r--tests/test_item.rs68
-rw-r--r--tests/test_lit.rs9
-rw-r--r--tests/test_meta.rs2
-rw-r--r--tests/test_parse_buffer.rs4
-rw-r--r--tests/test_path.rs22
-rw-r--r--tests/test_precedence.rs82
-rw-r--r--tests/test_round_trip.rs17
-rw-r--r--tests/test_size.rs2
-rw-r--r--tests/test_stmt.rs2
-rw-r--r--tests/test_ty.rs132
58 files changed, 2130 insertions, 2702 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index cb0b7f12..36a487f8 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,5 @@
{
"git": {
- "sha1": "7ff292d5ac9802a3cc7908c5641a060bd5cf0d78"
- },
- "path_in_vcs": ""
-} \ No newline at end of file
+ "sha1": "c80b47159a47340d20f5774d2fe1c09bd0994a13"
+ }
+}
diff --git a/Android.bp b/Android.bp
index 1ec1d6c2..7445c4c0 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,4 @@
-// This file is generated by cargo2android.py --config cargo2android.json.
+// This file is generated by cargo2android.py --run --dependencies --features=full,visit,visit-mut,extra-traits --features=default,full,visit,visit-mut,extra-traits --host-first-multilib.
// Do not modify this file as changes will be overridden on upgrade.
package {
@@ -40,8 +40,6 @@ license {
rust_library_host {
name: "libsyn",
crate_name: "syn",
- cargo_env_compat: true,
- cargo_pkg_version: "1.0.86",
srcs: ["src/lib.rs"],
edition: "2018",
features: [
@@ -57,7 +55,9 @@ rust_library_host {
"visit",
"visit-mut",
],
- cfgs: ["syn_disable_nightly_tests"],
+ flags: [
+ "--cfg syn_disable_nightly_tests",
+ ],
rustlibs: [
"libproc_macro2",
"libquote",
@@ -65,3 +65,8 @@ rust_library_host {
],
compile_multilib: "first",
}
+
+// dependent_library ["feature_list"]
+// proc-macro2-1.0.26 "default,proc-macro"
+// quote-1.0.9 "default,proc-macro"
+// unicode-xid-0.2.1 "default"
diff --git a/Cargo.toml b/Cargo.toml
index 11f06196..b2dbe617 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,17 +3,17 @@
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies.
+# to registry (e.g., crates.io) dependencies
#
-# If you are reading this file be aware that the original Cargo.toml
-# will likely look very different (and much more reasonable).
-# See Cargo.toml.orig for the original contents.
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
[package]
edition = "2018"
-rust-version = "1.31"
name = "syn"
-version = "1.0.86"
+version = "1.0.69"
authors = ["David Tolnay <dtolnay@gmail.com>"]
include = ["/benches/**", "/build.rs", "/Cargo.toml", "/LICENSE-APACHE", "/LICENSE-MIT", "/README.md", "/src/**", "/tests/**"]
description = "Parser for Rust source code"
@@ -39,7 +39,7 @@ required-features = ["full", "parsing"]
name = "file"
required-features = ["full", "parsing"]
[dependencies.proc-macro2]
-version = "1.0.32"
+version = "1.0.26"
default-features = false
[dependencies.quote]
@@ -52,9 +52,6 @@ version = "0.2"
[dev-dependencies.anyhow]
version = "1.0"
-[dev-dependencies.automod]
-version = "1.0"
-
[dev-dependencies.flate2]
version = "1.0"
@@ -71,7 +68,7 @@ version = "1.0"
version = "1.0"
[dev-dependencies.reqwest]
-version = "0.11"
+version = "0.10"
features = ["blocking"]
[dev-dependencies.syn-test-suite]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index b6fc02a3..d29b93db 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "syn"
-version = "1.0.86" # don't forget to update html_root_url and syn.json
+version = "1.0.69" # don't forget to update html_root_url and syn.json
authors = ["David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0"
description = "Parser for Rust source code"
@@ -19,7 +19,6 @@ include = [
"/tests/**",
]
edition = "2018"
-rust-version = "1.31"
[features]
default = ["derive", "parsing", "printing", "clone-impls", "proc-macro"]
@@ -36,19 +35,18 @@ proc-macro = ["proc-macro2/proc-macro", "quote/proc-macro"]
test = ["syn-test-suite/all-features"]
[dependencies]
-proc-macro2 = { version = "1.0.32", default-features = false }
+proc-macro2 = { version = "1.0.26", default-features = false }
quote = { version = "1.0", optional = true, default-features = false }
unicode-xid = "0.2"
[dev-dependencies]
anyhow = "1.0"
-automod = "1.0"
flate2 = "1.0"
insta = "1.0"
rayon = "1.0"
ref-cast = "1.0"
regex = "1.0"
-reqwest = { version = "0.11", features = ["blocking"] }
+reqwest = { version = "0.10", features = ["blocking"] }
syn-test-suite = { version = "0", path = "tests/features" }
tar = "0.4.16"
termcolor = "1.0"
@@ -72,4 +70,4 @@ rustdoc-args = ["--cfg", "doc_cfg"]
features = ["full", "visit", "visit-mut", "fold", "extra-traits"]
[workspace]
-members = ["dev", "json", "tests/crates", "tests/features"]
+members = ["dev", "json", "tests/features"]
diff --git a/METADATA b/METADATA
index e4a80129..366fd603 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/syn/syn-1.0.86.crate"
+ value: "https://static.crates.io/crates/syn/syn-1.0.69.crate"
}
- version: "1.0.86"
+ version: "1.0.69"
license_type: NOTICE
last_upgrade_date {
- year: 2022
- month: 3
- day: 1
+ year: 2021
+ month: 4
+ day: 13
}
}
diff --git a/README.md b/README.md
index 38005f5e..12b5f45b 100644
--- a/README.md
+++ b/README.md
@@ -150,7 +150,7 @@ By tracking span information all the way through the expansion of a procedural
macro as shown in the `heapsize` example, token-based macros in Syn are able to
trigger errors that directly pinpoint the source of the problem.
-```console
+```
error[E0277]: the trait bound `std::thread::Thread: HeapSize` is not satisfied
--> src/main.rs:7:5
|
@@ -171,7 +171,7 @@ Syn's parsing API.
The example reimplements the popular `lazy_static` crate from crates.io as a
procedural macro.
-```rust
+```
lazy_static! {
static ref USERNAME: Regex = Regex::new("^[a-z0-9_-]{3,16}$").unwrap();
}
@@ -180,7 +180,7 @@ lazy_static! {
The implementation shows how to trigger custom warnings and error messages on
the macro input.
-```console
+```
warning: come on, pick a more creative name
--> src/main.rs:10:16
|
diff --git a/TEST_MAPPING b/TEST_MAPPING
index bff320d4..ff7187ba 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,228 +1,221 @@
// Generated by update_crate_tests.py for tests that depend on this crate.
{
- "imports": [
+ "presubmit": [
{
- "path": "external/rust/crates/anyhow"
+ "name": "ZipFuseTest"
},
{
- "path": "external/rust/crates/arbitrary"
+ "name": "anyhow_device_test_src_lib"
},
{
- "path": "external/rust/crates/argh"
+ "name": "anyhow_device_test_tests_test_autotrait"
},
{
- "path": "external/rust/crates/base64"
+ "name": "anyhow_device_test_tests_test_boxed"
},
{
- "path": "external/rust/crates/bitflags"
+ "name": "anyhow_device_test_tests_test_chain"
},
{
- "path": "external/rust/crates/bytes"
+ "name": "anyhow_device_test_tests_test_context"
},
{
- "path": "external/rust/crates/either"
+ "name": "anyhow_device_test_tests_test_convert"
},
{
- "path": "external/rust/crates/futures-util"
+ "name": "anyhow_device_test_tests_test_downcast"
},
{
- "path": "external/rust/crates/jni"
+ "name": "anyhow_device_test_tests_test_ffi"
},
{
- "path": "external/rust/crates/libm"
+ "name": "anyhow_device_test_tests_test_fmt"
},
{
- "path": "external/rust/crates/oid-registry"
+ "name": "anyhow_device_test_tests_test_macros"
},
{
- "path": "external/rust/crates/rand_chacha"
+ "name": "anyhow_device_test_tests_test_repr"
},
{
- "path": "external/rust/crates/serde"
+ "name": "anyhow_device_test_tests_test_source"
},
{
- "path": "external/rust/crates/serde-xml-rs"
+ "name": "authfs_device_test_src_lib"
},
{
- "path": "external/rust/crates/serde_cbor"
+ "name": "doh_unit_test"
},
{
- "path": "external/rust/crates/slab"
+ "name": "either_device_test_src_lib"
},
{
- "path": "external/rust/crates/tinytemplate"
+ "name": "futures-util_device_test_src_lib"
},
{
- "path": "external/rust/crates/tinyvec"
+ "name": "keystore2_crypto_test_rust"
},
{
- "path": "external/rust/crates/tokio"
+ "name": "keystore2_selinux_test"
},
{
- "path": "external/rust/crates/tokio-test"
+ "name": "keystore2_test"
},
{
- "path": "external/rust/crates/unicode-bidi"
+ "name": "libm_device_test_src_lib"
},
{
- "path": "external/rust/crates/unicode-xid"
+ "name": "serde_cbor_device_test_src_lib"
},
{
- "path": "external/rust/crates/url"
- }
- ],
- "presubmit": [
- {
- "name": "ZipFuseTest"
+ "name": "serde_cbor_device_test_tests_bennofs"
},
{
- "name": "apkdmverity.test"
+ "name": "serde_cbor_device_test_tests_canonical"
},
{
- "name": "authfs_device_test_src_lib"
+ "name": "serde_cbor_device_test_tests_de"
},
{
- "name": "diced_open_dice_cbor_test"
+ "name": "serde_cbor_device_test_tests_enum"
},
{
- "name": "diced_sample_inputs_test"
+ "name": "serde_cbor_device_test_tests_ser"
},
{
- "name": "diced_test"
+ "name": "serde_cbor_device_test_tests_std_types"
},
{
- "name": "diced_utils_test"
+ "name": "serde_cbor_device_test_tests_tags"
},
{
- "name": "diced_vendor_test"
+ "name": "serde_cbor_device_test_tests_value"
},
{
- "name": "doh_unit_test"
+ "name": "serde_test_device_test_src_lib"
},
{
- "name": "keystore2_crypto_test_rust"
+ "name": "tokio-test_device_test_src_lib"
},
{
- "name": "keystore2_km_compat_test"
+ "name": "tokio-test_device_test_tests_block_on"
},
{
- "name": "keystore2_selinux_concurrency_test"
+ "name": "tokio-test_device_test_tests_io"
},
{
- "name": "keystore2_selinux_test"
+ "name": "tokio-test_device_test_tests_macros"
},
{
- "name": "keystore2_test"
+ "name": "tokio_device_test_tests_buffered"
},
{
- "name": "keystore2_test_utils_test"
+ "name": "tokio_device_test_tests_io_async_read"
},
{
- "name": "keystore2_vintf_test"
+ "name": "tokio_device_test_tests_io_copy_bidirectional"
},
{
- "name": "legacykeystore_test"
+ "name": "tokio_device_test_tests_io_lines"
},
{
- "name": "libapkverify.integration_test"
+ "name": "tokio_device_test_tests_io_mem_stream"
},
{
- "name": "libapkverify.test"
+ "name": "tokio_device_test_tests_io_read"
},
{
- "name": "libcert_request_validator_tests"
+ "name": "tokio_device_test_tests_io_read_buf"
},
{
- "name": "libidsig.test"
+ "name": "tokio_device_test_tests_io_read_to_end"
},
{
- "name": "librustutils_test"
+ "name": "tokio_device_test_tests_io_take"
},
{
- "name": "microdroid_manager_test"
+ "name": "tokio_device_test_tests_io_write"
},
{
- "name": "rustBinderTest"
+ "name": "tokio_device_test_tests_io_write_all"
},
{
- "name": "virtualizationservice_device_test"
- }
- ],
- "presubmit-rust": [
+ "name": "tokio_device_test_tests_io_write_buf"
+ },
{
- "name": "ZipFuseTest"
+ "name": "tokio_device_test_tests_io_write_int"
},
{
- "name": "apkdmverity.test"
+ "name": "tokio_device_test_tests_macros_join"
},
{
- "name": "authfs_device_test_src_lib"
+ "name": "tokio_device_test_tests_no_rt"
},
{
- "name": "diced_open_dice_cbor_test"
+ "name": "tokio_device_test_tests_rt_basic"
},
{
- "name": "diced_sample_inputs_test"
+ "name": "tokio_device_test_tests_rt_threaded"
},
{
- "name": "diced_test"
+ "name": "tokio_device_test_tests_sync_barrier"
},
{
- "name": "diced_utils_test"
+ "name": "tokio_device_test_tests_sync_broadcast"
},
{
- "name": "diced_vendor_test"
+ "name": "tokio_device_test_tests_sync_errors"
},
{
- "name": "doh_unit_test"
+ "name": "tokio_device_test_tests_sync_mpsc"
},
{
- "name": "keystore2_crypto_test_rust"
+ "name": "tokio_device_test_tests_sync_mutex_owned"
},
{
- "name": "keystore2_km_compat_test"
+ "name": "tokio_device_test_tests_sync_rwlock"
},
{
- "name": "keystore2_selinux_concurrency_test"
+ "name": "tokio_device_test_tests_sync_watch"
},
{
- "name": "keystore2_selinux_test"
+ "name": "tokio_device_test_tests_task_local"
},
{
- "name": "keystore2_test"
+ "name": "tokio_device_test_tests_task_local_set"
},
{
- "name": "keystore2_test_utils_test"
+ "name": "tokio_device_test_tests_tcp_accept"
},
{
- "name": "keystore2_vintf_test"
+ "name": "tokio_device_test_tests_tcp_echo"
},
{
- "name": "legacykeystore_test"
+ "name": "tokio_device_test_tests_tcp_into_std"
},
{
- "name": "libapkverify.integration_test"
+ "name": "tokio_device_test_tests_tcp_shutdown"
},
{
- "name": "libapkverify.test"
+ "name": "tokio_device_test_tests_time_rt"
},
{
- "name": "libcert_request_validator_tests"
+ "name": "tokio_device_test_tests_uds_split"
},
{
- "name": "libidsig.test"
+ "name": "unicode-bidi_device_test_src_lib"
},
{
- "name": "librustutils_test"
+ "name": "url_device_test_src_lib"
},
{
- "name": "microdroid_manager_test"
+ "name": "url_device_test_tests_data"
},
{
- "name": "rustBinderTest"
+ "name": "url_device_test_tests_unit"
},
{
- "name": "virtualizationservice_device_test"
+ "name": "vpnprofilestore_test"
}
]
}
diff --git a/benches/file.rs b/benches/file.rs
index 86204df2..58ab8df2 100644
--- a/benches/file.rs
+++ b/benches/file.rs
@@ -2,7 +2,6 @@
#![feature(rustc_private, test)]
#![recursion_limit = "1024"]
-#![allow(clippy::missing_panics_doc, clippy::must_use_candidate)]
extern crate test;
@@ -20,7 +19,7 @@ use std::fs;
use std::str::FromStr;
use test::Bencher;
-const FILE: &str = "tests/rust/library/core/src/str/mod.rs";
+const FILE: &str = "tests/rust/src/libcore/str/mod.rs";
#[bench]
fn parse_file(b: &mut Bencher) {
diff --git a/benches/rust.rs b/benches/rust.rs
index 54542932..50e1a7f6 100644
--- a/benches/rust.rs
+++ b/benches/rust.rs
@@ -5,7 +5,6 @@
#![cfg_attr(not(syn_only), feature(rustc_private))]
#![recursion_limit = "1024"]
-#![allow(clippy::cast_lossless, clippy::unnecessary_wraps)]
#[macro_use]
#[path = "../tests/macros/mod.rs"]
@@ -59,7 +58,7 @@ mod librustc_parse {
}
}
- rustc_span::create_session_if_not_set_then(Edition::Edition2018, |_| {
+ rustc_span::with_session_globals(Edition::Edition2018, || {
let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let emitter = Box::new(SilentEmitter);
let handler = Handler::with_emitter(false, None, emitter);
@@ -117,7 +116,7 @@ fn main() {
macro_rules! testcases {
($($(#[$cfg:meta])* $name:ident,)*) => {
- [
+ vec![
$(
$(#[$cfg])*
(stringify!($name), $name::bench as fn(&str) -> Result<(), ()>),
diff --git a/build.rs b/build.rs
index c705fc50..25190f4c 100644
--- a/build.rs
+++ b/build.rs
@@ -19,10 +19,6 @@ fn main() {
println!("cargo:rustc-cfg=syn_no_const_vec_new");
}
- if compiler.minor < 56 {
- println!("cargo:rustc-cfg=syn_no_negative_literal_parse");
- }
-
if !compiler.nightly {
println!("cargo:rustc-cfg=syn_disable_nightly_tests");
}
@@ -42,6 +38,6 @@ fn rustc_version() -> Option<Compiler> {
return None;
}
let minor = pieces.next()?.parse().ok()?;
- let nightly = version.contains("nightly") || version.ends_with("-dev");
+ let nightly = version.contains("nightly");
Some(Compiler { minor, nightly })
}
diff --git a/cargo2android.json b/cargo2android.json
deleted file mode 100644
index 5f9ce448..00000000
--- a/cargo2android.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "features": "default,full,visit,visit-mut,extra-traits",
- "host-first-multilib": true,
- "run": true
-} \ No newline at end of file
diff --git a/src/attr.rs b/src/attr.rs
index bace94f4..794a3104 100644
--- a/src/attr.rs
+++ b/src/attr.rs
@@ -2,7 +2,6 @@ use super::*;
use crate::punctuated::Punctuated;
use proc_macro2::TokenStream;
use std::iter;
-use std::slice;
#[cfg(feature = "parsing")]
use crate::parse::{Parse, ParseBuffer, ParseStream, Parser, Result};
@@ -251,7 +250,9 @@ impl Attribute {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
pub fn parse_inner(input: ParseStream) -> Result<Vec<Self>> {
let mut attrs = Vec::new();
- parsing::parse_inner(input, &mut attrs)?;
+ while input.peek(Token![#]) && input.peek2(Token![!]) {
+ attrs.push(input.call(parsing::single_parse_inner)?);
+ }
Ok(attrs)
}
}
@@ -470,8 +471,11 @@ pub trait FilterAttrs<'a> {
fn inner(self) -> Self::Ret;
}
-impl<'a> FilterAttrs<'a> for &'a [Attribute] {
- type Ret = iter::Filter<slice::Iter<'a, Attribute>, fn(&&Attribute) -> bool>;
+impl<'a, T> FilterAttrs<'a> for T
+where
+ T: IntoIterator<Item = &'a Attribute>,
+{
+ type Ret = iter::Filter<T::IntoIter, fn(&&Attribute) -> bool>;
fn outer(self) -> Self::Ret {
fn is_outer(attr: &&Attribute) -> bool {
@@ -480,7 +484,7 @@ impl<'a> FilterAttrs<'a> for &'a [Attribute] {
AttrStyle::Inner(_) => false,
}
}
- self.iter().filter(is_outer)
+ self.into_iter().filter(is_outer)
}
fn inner(self) -> Self::Ret {
@@ -490,7 +494,7 @@ impl<'a> FilterAttrs<'a> for &'a [Attribute] {
AttrStyle::Outer => false,
}
}
- self.iter().filter(is_inner)
+ self.into_iter().filter(is_inner)
}
}
@@ -499,13 +503,8 @@ pub mod parsing {
use super::*;
use crate::ext::IdentExt;
use crate::parse::{Parse, ParseStream, Result};
-
- pub fn parse_inner(input: ParseStream, attrs: &mut Vec<Attribute>) -> Result<()> {
- while input.peek(Token![#]) && input.peek2(Token![!]) {
- attrs.push(input.call(parsing::single_parse_inner)?);
- }
- Ok(())
- }
+ #[cfg(feature = "full")]
+ use crate::private;
pub fn single_parse_inner(input: ParseStream) -> Result<Attribute> {
let content;
@@ -529,6 +528,15 @@ pub mod parsing {
})
}
+ #[cfg(feature = "full")]
+ impl private {
+ pub(crate) fn attrs(outer: Vec<Attribute>, inner: Vec<Attribute>) -> Vec<Attribute> {
+ let mut attrs = outer;
+ attrs.extend(inner);
+ attrs
+ }
+ }
+
// Like Path::parse_mod_style but accepts keywords in the path.
fn parse_meta_path(input: ParseStream) -> Result<Path> {
Ok(Path {
@@ -647,7 +655,7 @@ mod printing {
self.path.to_tokens(tokens);
self.paren_token.surround(tokens, |tokens| {
self.nested.to_tokens(tokens);
- });
+ })
}
}
diff --git a/src/buffer.rs b/src/buffer.rs
index 43e77e97..ec172259 100644
--- a/src/buffer.rs
+++ b/src/buffer.rs
@@ -16,7 +16,6 @@ use crate::Lifetime;
use proc_macro2::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
use std::marker::PhantomData;
use std::ptr;
-use std::slice;
/// Internal type which is used instead of `TokenTree` to represent a token tree
/// within a `TokenBuffer`.
@@ -37,30 +36,20 @@ enum Entry {
///
/// *This type is available only if Syn is built with the `"parsing"` feature.*
pub struct TokenBuffer {
- // NOTE: Do not implement clone on this - there are raw pointers inside
- // these entries which will be messed up. Moving the `TokenBuffer` itself is
- // safe as the data pointed to won't be moved.
- ptr: *const Entry,
- len: usize,
-}
-
-impl Drop for TokenBuffer {
- fn drop(&mut self) {
- unsafe {
- let slice = slice::from_raw_parts_mut(self.ptr as *mut Entry, self.len);
- let _ = Box::from_raw(slice);
- }
- }
+ // NOTE: Do not derive clone on this - there are raw pointers inside which
+ // will be messed up. Moving the `TokenBuffer` itself is safe as the actual
+ // backing slices won't be moved.
+ data: Box<[Entry]>,
}
impl TokenBuffer {
- // NOTE: Do not mutate the Vec returned from this function once it returns;
- // the address of its backing memory must remain stable.
+ // NOTE: DO NOT MUTATE THE `Vec` RETURNED FROM THIS FUNCTION ONCE IT
+ // RETURNS, THE ADDRESS OF ITS BACKING MEMORY MUST REMAIN STABLE.
fn inner_new(stream: TokenStream, up: *const Entry) -> TokenBuffer {
// Build up the entries list, recording the locations of any Groups
// in the list to be processed later.
let mut entries = Vec::new();
- let mut groups = Vec::new();
+ let mut seqs = Vec::new();
for tt in stream {
match tt {
TokenTree::Ident(sym) => {
@@ -74,8 +63,8 @@ impl TokenBuffer {
}
TokenTree::Group(g) => {
// Record the index of the interesting entry, and store an
- // `End(null)` there temporarily.
- groups.push((entries.len(), g));
+ // `End(null)` there temporarially.
+ seqs.push((entries.len(), g));
entries.push(Entry::End(ptr::null()));
}
}
@@ -89,28 +78,23 @@ impl TokenBuffer {
// constant address after this point, as we are going to store a raw
// pointer into it.
let mut entries = entries.into_boxed_slice();
- for (idx, group) in groups {
+ for (idx, group) in seqs {
// We know that this index refers to one of the temporary
// `End(null)` entries, and we know that the last entry is
// `End(up)`, so the next index is also valid.
- let group_up = unsafe { entries.as_ptr().add(idx + 1) };
+ let seq_up = &entries[idx + 1] as *const Entry;
// The end entry stored at the end of this Entry::Group should
// point to the Entry which follows the Group in the list.
- let inner = Self::inner_new(group.stream(), group_up);
+ let inner = Self::inner_new(group.stream(), seq_up);
entries[idx] = Entry::Group(group, inner);
}
- let len = entries.len();
- let ptr = Box::into_raw(entries);
- TokenBuffer {
- ptr: ptr as *const Entry,
- len,
- }
+ TokenBuffer { data: entries }
}
/// Creates a `TokenBuffer` containing all the tokens from the input
- /// `proc_macro::TokenStream`.
+ /// `TokenStream`.
///
/// *This method is available only if Syn is built with both the `"parsing"` and
/// `"proc-macro"` features.*
@@ -118,20 +102,20 @@ impl TokenBuffer {
not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
feature = "proc-macro"
))]
- pub fn new(stream: pm::TokenStream) -> Self {
+ pub fn new(stream: pm::TokenStream) -> TokenBuffer {
Self::new2(stream.into())
}
/// Creates a `TokenBuffer` containing all the tokens from the input
- /// `proc_macro2::TokenStream`.
- pub fn new2(stream: TokenStream) -> Self {
+ /// `TokenStream`.
+ pub fn new2(stream: TokenStream) -> TokenBuffer {
Self::inner_new(stream, ptr::null())
}
/// Creates a cursor referencing the first token in the buffer and able to
/// traverse until the end of the buffer.
pub fn begin(&self) -> Cursor {
- unsafe { Cursor::create(self.ptr, self.ptr.add(self.len - 1)) }
+ unsafe { Cursor::create(&self.data[0], &self.data[self.data.len() - 1]) }
}
}
@@ -226,7 +210,7 @@ impl<'a> Cursor<'a> {
// situations where we should immediately exit the span after
// entering it are handled correctly.
unsafe {
- *self = Cursor::create(buf.ptr, self.scope);
+ *self = Cursor::create(&buf.data[0], self.scope);
}
} else {
break;
@@ -270,7 +254,7 @@ impl<'a> Cursor<'a> {
}
}
- /// If the cursor is pointing at a `Punct`, returns it along with a cursor
+ /// If the cursor is pointing at an `Punct`, returns it along with a cursor
/// pointing at the next `TokenTree`.
pub fn punct(mut self) -> Option<(Punct, Cursor<'a>)> {
self.ignore_none();
@@ -337,7 +321,9 @@ impl<'a> Cursor<'a> {
Entry::Literal(lit) => lit.clone().into(),
Entry::Ident(ident) => ident.clone().into(),
Entry::Punct(op) => op.clone().into(),
- Entry::End(..) => return None,
+ Entry::End(..) => {
+ return None;
+ }
};
Some((tree, unsafe { self.bump() }))
diff --git a/src/data.rs b/src/data.rs
index dc2138c1..731f5a0a 100644
--- a/src/data.rs
+++ b/src/data.rs
@@ -246,29 +246,29 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for Variant {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let attrs = input.call(Attribute::parse_outer)?;
let _visibility: Visibility = input.parse()?;
- let ident: Ident = input.parse()?;
- let fields = if input.peek(token::Brace) {
- let fields = parse_braced(input, &mut attrs)?;
- Fields::Named(fields)
- } else if input.peek(token::Paren) {
- Fields::Unnamed(input.parse()?)
- } else {
- Fields::Unit
- };
- let discriminant = if input.peek(Token![=]) {
- let eq_token: Token![=] = input.parse()?;
- let discriminant: Expr = input.parse()?;
- Some((eq_token, discriminant))
- } else {
- None
- };
Ok(Variant {
attrs,
- ident,
- fields,
- discriminant,
+ ident: input.parse()?,
+ fields: {
+ if input.peek(token::Brace) {
+ Fields::Named(input.parse()?)
+ } else if input.peek(token::Paren) {
+ Fields::Unnamed(input.parse()?)
+ } else {
+ Fields::Unit
+ }
+ },
+ discriminant: {
+ if input.peek(Token![=]) {
+ let eq_token: Token![=] = input.parse()?;
+ let discriminant: Expr = input.parse()?;
+ Some((eq_token, discriminant))
+ } else {
+ None
+ }
+ },
})
}
}
@@ -295,17 +295,6 @@ pub mod parsing {
}
}
- pub(crate) fn parse_braced(
- input: ParseStream,
- attrs: &mut Vec<Attribute>,
- ) -> Result<FieldsNamed> {
- let content;
- let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, attrs)?;
- let named = content.parse_terminated(Field::parse_named)?;
- Ok(FieldsNamed { brace_token, named })
- }
-
impl Field {
/// Parses a named (braced struct) field.
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
@@ -313,11 +302,7 @@ pub mod parsing {
Ok(Field {
attrs: input.call(Attribute::parse_outer)?,
vis: input.parse()?,
- ident: Some(if input.peek(Token![_]) {
- input.call(Ident::parse_any)
- } else {
- input.parse()
- }?),
+ ident: Some(input.parse()?),
colon_token: Some(input.parse()?),
ty: input.parse()?,
})
@@ -479,7 +464,7 @@ mod printing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))]
impl ToTokens for VisPublic {
fn to_tokens(&self, tokens: &mut TokenStream) {
- self.pub_token.to_tokens(tokens);
+ self.pub_token.to_tokens(tokens)
}
}
diff --git a/src/derive.rs b/src/derive.rs
index 17387e45..af9bb91b 100644
--- a/src/derive.rs
+++ b/src/derive.rs
@@ -95,7 +95,7 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for DeriveInput {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let attrs = input.call(Attribute::parse_outer)?;
let vis = input.parse::<Visibility>()?;
let lookahead = input.lookahead1();
@@ -103,7 +103,7 @@ pub mod parsing {
let struct_token = input.parse::<Token![struct]>()?;
let ident = input.parse::<Ident>()?;
let generics = input.parse::<Generics>()?;
- let (where_clause, fields, semi) = data_struct(input, &mut attrs)?;
+ let (where_clause, fields, semi) = data_struct(input)?;
Ok(DeriveInput {
attrs,
vis,
@@ -122,7 +122,7 @@ pub mod parsing {
let enum_token = input.parse::<Token![enum]>()?;
let ident = input.parse::<Ident>()?;
let generics = input.parse::<Generics>()?;
- let (where_clause, brace, variants) = data_enum(input, &mut attrs)?;
+ let (where_clause, brace, variants) = data_enum(input)?;
Ok(DeriveInput {
attrs,
vis,
@@ -141,7 +141,7 @@ pub mod parsing {
let union_token = input.parse::<Token![union]>()?;
let ident = input.parse::<Ident>()?;
let generics = input.parse::<Generics>()?;
- let (where_clause, fields) = data_union(input, &mut attrs)?;
+ let (where_clause, fields) = data_union(input)?;
Ok(DeriveInput {
attrs,
vis,
@@ -163,7 +163,6 @@ pub mod parsing {
pub fn data_struct(
input: ParseStream,
- attrs: &mut Vec<Attribute>,
) -> Result<(Option<WhereClause>, Fields, Option<Token![;]>)> {
let mut lookahead = input.lookahead1();
let mut where_clause = None;
@@ -188,7 +187,7 @@ pub mod parsing {
Err(lookahead.error())
}
} else if lookahead.peek(token::Brace) {
- let fields = data::parsing::parse_braced(input, attrs)?;
+ let fields = input.parse()?;
Ok((where_clause, Fields::Named(fields), None))
} else if lookahead.peek(Token![;]) {
let semi = input.parse()?;
@@ -200,7 +199,6 @@ pub mod parsing {
pub fn data_enum(
input: ParseStream,
- attrs: &mut Vec<Attribute>,
) -> Result<(
Option<WhereClause>,
token::Brace,
@@ -210,18 +208,14 @@ pub mod parsing {
let content;
let brace = braced!(content in input);
- attr::parsing::parse_inner(&content, attrs)?;
let variants = content.parse_terminated(Variant::parse)?;
Ok((where_clause, brace, variants))
}
- pub fn data_union(
- input: ParseStream,
- attrs: &mut Vec<Attribute>,
- ) -> Result<(Option<WhereClause>, FieldsNamed)> {
+ pub fn data_union(input: ParseStream) -> Result<(Option<WhereClause>, FieldsNamed)> {
let where_clause = input.parse()?;
- let fields = data::parsing::parse_braced(input, attrs)?;
+ let fields = input.parse()?;
Ok((where_clause, fields))
}
}
diff --git a/src/discouraged.rs b/src/discouraged.rs
index a46129b6..76c9fce6 100644
--- a/src/discouraged.rs
+++ b/src/discouraged.rs
@@ -189,6 +189,6 @@ impl<'a> Speculative for ParseBuffer<'a> {
// See comment on `cell` in the struct definition.
self.cell
- .set(unsafe { mem::transmute::<Cursor, Cursor<'static>>(fork.cursor()) });
+ .set(unsafe { mem::transmute::<Cursor, Cursor<'static>>(fork.cursor()) })
}
}
diff --git a/src/error.rs b/src/error.rs
index b505b894..780731c8 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -47,11 +47,10 @@ pub type Result<T> = std::result::Result<T, Error>;
/// ```
///
/// For errors that arise later than the initial parsing stage, the
-/// [`.to_compile_error()`] or [`.into_compile_error()`] methods can be used to
-/// perform an explicit conversion to `compile_error!`.
+/// [`.to_compile_error()`] method can be used to perform an explicit conversion
+/// to `compile_error!`.
///
/// [`.to_compile_error()`]: Error::to_compile_error
-/// [`.into_compile_error()`]: Error::into_compile_error
///
/// ```
/// # extern crate proc_macro;
@@ -67,7 +66,7 @@ pub type Result<T> = std::result::Result<T, Error>;
///
/// // fn(DeriveInput) -> syn::Result<proc_macro2::TokenStream>
/// expand::my_derive(input)
-/// .unwrap_or_else(syn::Error::into_compile_error)
+/// .unwrap_or_else(|err| err.to_compile_error())
/// .into()
/// }
/// #
@@ -237,7 +236,7 @@ impl Error {
/// Add another error message to self such that when `to_compile_error()` is
/// called, both errors will be emitted together.
pub fn combine(&mut self, another: Error) {
- self.messages.extend(another.messages);
+ self.messages.extend(another.messages)
}
}
diff --git a/src/export.rs b/src/export.rs
index d3a08784..601a214b 100644
--- a/src/export.rs
+++ b/src/export.rs
@@ -1,5 +1,6 @@
pub use std::clone::Clone;
pub use std::cmp::{Eq, PartialEq};
+pub use std::convert::From;
pub use std::default::Default;
pub use std::fmt::{self, Debug, Formatter};
pub use std::hash::{Hash, Hasher};
diff --git a/src/expr.rs b/src/expr.rs
index 95da0908..a35532d4 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -403,8 +403,8 @@ ast_struct! {
#[cfg_attr(doc_cfg, doc(cfg(feature = "full")))]
pub struct ExprClosure #full {
pub attrs: Vec<Attribute>,
- pub movability: Option<Token![static]>,
pub asyncness: Option<Token![async]>,
+ pub movability: Option<Token![static]>,
pub capture: Option<Token![move]>,
pub or1_token: Token![|],
pub inputs: Punctuated<Pat, Token![,]>,
@@ -851,24 +851,6 @@ ast_enum! {
}
}
-impl From<Ident> for Member {
- fn from(ident: Ident) -> Member {
- Member::Named(ident)
- }
-}
-
-impl From<Index> for Member {
- fn from(index: Index) -> Member {
- Member::Unnamed(index)
- }
-}
-
-impl From<usize> for Member {
- fn from(index: usize) -> Member {
- Member::Unnamed(Index::from(index))
- }
-}
-
impl Eq for Member {}
impl PartialEq for Member {
@@ -1340,7 +1322,6 @@ pub(crate) mod parsing {
let rhs = if input.is_empty()
|| input.peek(Token![,])
|| input.peek(Token![;])
- || input.peek(Token![.]) && !input.peek(Token![..])
|| !allow_struct.0 && input.peek(token::Brace)
{
None
@@ -1542,7 +1523,7 @@ pub(crate) mod parsing {
// <atom> ? ...
#[cfg(feature = "full")]
fn trailer_expr(
- mut attrs: Vec<Attribute>,
+ outer_attrs: Vec<Attribute>,
input: ParseStream,
allow_struct: AllowStruct,
) -> Result<Expr> {
@@ -1550,7 +1531,7 @@ pub(crate) mod parsing {
let mut e = trailer_helper(input, atom)?;
let inner_attrs = e.replace_attrs(Vec::new());
- attrs.extend(inner_attrs);
+ let attrs = private::attrs(outer_attrs, inner_attrs);
e.replace_attrs(attrs);
Ok(e)
}
@@ -1566,13 +1547,7 @@ pub(crate) mod parsing {
paren_token: parenthesized!(content in input),
args: content.parse_terminated(Expr::parse)?,
});
- } else if input.peek(Token![.])
- && !input.peek(Token![..])
- && match e {
- Expr::Range(_) => false,
- _ => true,
- }
- {
+ } else if input.peek(Token![.]) && !input.peek(Token![..]) {
let mut dot_token: Token![.] = input.parse()?;
let await_token: Option<token::Await> = input.parse()?;
@@ -1824,10 +1799,12 @@ pub(crate) mod parsing {
#[cfg(feature = "full")]
fn path_or_macro_or_struct(input: ParseStream, allow_struct: AllowStruct) -> Result<Expr> {
- let begin = input.fork();
let expr: ExprPath = input.parse()?;
+ if expr.qself.is_some() {
+ return Ok(Expr::Path(expr));
+ }
- if expr.qself.is_none() && input.peek(Token![!]) && !input.peek(Token![!=]) {
+ if input.peek(Token![!]) && !input.peek(Token![!=]) {
let mut contains_arguments = false;
for segment in &expr.path.segments {
match segment.arguments {
@@ -1855,12 +1832,7 @@ pub(crate) mod parsing {
if allow_struct.0 && input.peek(token::Brace) {
let outer_attrs = Vec::new();
- let expr_struct = expr_struct_helper(input, outer_attrs, expr.path)?;
- if expr.qself.is_some() {
- Ok(Expr::Verbatim(verbatim::between(begin, input)))
- } else {
- Ok(Expr::Struct(expr_struct))
- }
+ expr_struct_helper(input, outer_attrs, expr.path).map(Expr::Struct)
} else {
Ok(Expr::Path(expr))
}
@@ -2112,11 +2084,7 @@ pub(crate) mod parsing {
let_token: input.parse()?,
pat: pat::parsing::multi_pat_with_leading_vert(input)?,
eq_token: input.parse()?,
- expr: Box::new({
- let allow_struct = AllowStruct(false);
- let lhs = unary_expr(input, allow_struct)?;
- parse_expr(input, lhs, allow_struct, Precedence::Compare)?
- }),
+ expr: Box::new(input.call(Expr::parse_without_eager_brace)?),
})
}
}
@@ -2166,7 +2134,7 @@ pub(crate) mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprForLoop {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let outer_attrs = input.call(Attribute::parse_outer)?;
let label: Option<Label> = input.parse()?;
let for_token: Token![for] = input.parse()?;
@@ -2177,11 +2145,11 @@ pub(crate) mod parsing {
let content;
let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, &mut attrs)?;
+ let inner_attrs = content.call(Attribute::parse_inner)?;
let stmts = content.call(Block::parse_within)?;
Ok(ExprForLoop {
- attrs,
+ attrs: private::attrs(outer_attrs, inner_attrs),
label,
for_token,
pat,
@@ -2196,17 +2164,17 @@ pub(crate) mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprLoop {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let outer_attrs = input.call(Attribute::parse_outer)?;
let label: Option<Label> = input.parse()?;
let loop_token: Token![loop] = input.parse()?;
let content;
let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, &mut attrs)?;
+ let inner_attrs = content.call(Attribute::parse_inner)?;
let stmts = content.call(Block::parse_within)?;
Ok(ExprLoop {
- attrs,
+ attrs: private::attrs(outer_attrs, inner_attrs),
label,
loop_token,
body: Block { brace_token, stmts },
@@ -2218,13 +2186,13 @@ pub(crate) mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprMatch {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let outer_attrs = input.call(Attribute::parse_outer)?;
let match_token: Token![match] = input.parse()?;
let expr = Expr::parse_without_eager_brace(input)?;
let content;
let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, &mut attrs)?;
+ let inner_attrs = content.call(Attribute::parse_inner)?;
let mut arms = Vec::new();
while !content.is_empty() {
@@ -2232,7 +2200,7 @@ pub(crate) mod parsing {
}
Ok(ExprMatch {
- attrs,
+ attrs: private::attrs(outer_attrs, inner_attrs),
match_token,
expr: Box::new(expr),
brace_token,
@@ -2401,8 +2369,12 @@ pub(crate) mod parsing {
#[cfg(feature = "full")]
fn expr_closure(input: ParseStream, allow_struct: AllowStruct) -> Result<ExprClosure> {
- let movability: Option<Token![static]> = input.parse()?;
let asyncness: Option<Token![async]> = input.parse()?;
+ let movability: Option<Token![static]> = if asyncness.is_none() {
+ input.parse()?
+ } else {
+ None
+ };
let capture: Option<Token![move]> = input.parse()?;
let or1_token: Token![|] = input.parse()?;
@@ -2440,8 +2412,8 @@ pub(crate) mod parsing {
Ok(ExprClosure {
attrs: Vec::new(),
- movability,
asyncness,
+ movability,
capture,
or1_token,
inputs,
@@ -2508,18 +2480,18 @@ pub(crate) mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprWhile {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let outer_attrs = input.call(Attribute::parse_outer)?;
let label: Option<Label> = input.parse()?;
let while_token: Token![while] = input.parse()?;
let cond = Expr::parse_without_eager_brace(input)?;
let content;
let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, &mut attrs)?;
+ let inner_attrs = content.call(Attribute::parse_inner)?;
let stmts = content.call(Block::parse_within)?;
Ok(ExprWhile {
- attrs,
+ attrs: private::attrs(outer_attrs, inner_attrs),
label,
while_token,
cond: Box::new(cond),
@@ -2648,12 +2620,13 @@ pub(crate) mod parsing {
#[cfg(feature = "full")]
fn expr_struct_helper(
input: ParseStream,
- mut attrs: Vec<Attribute>,
+ outer_attrs: Vec<Attribute>,
path: Path,
) -> Result<ExprStruct> {
let content;
let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, &mut attrs)?;
+ let inner_attrs = content.call(Attribute::parse_inner)?;
+ let attrs = private::attrs(outer_attrs, inner_attrs);
let mut fields = Punctuated::new();
while !content.is_empty() {
@@ -2726,16 +2699,16 @@ pub(crate) mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprBlock {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let outer_attrs = input.call(Attribute::parse_outer)?;
let label: Option<Label> = input.parse()?;
let content;
let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, &mut attrs)?;
+ let inner_attrs = content.call(Attribute::parse_inner)?;
let stmts = content.call(Block::parse_within)?;
Ok(ExprBlock {
- attrs,
+ attrs: private::attrs(outer_attrs, inner_attrs),
label,
block: Block { brace_token, stmts },
})
@@ -2752,7 +2725,6 @@ pub(crate) mod parsing {
if input.is_empty()
|| input.peek(Token![,])
|| input.peek(Token![;])
- || input.peek(Token![.]) && !input.peek(Token![..])
|| !allow_struct.0 && input.peek(token::Brace)
{
None
@@ -2947,7 +2919,7 @@ pub(crate) mod printing {
self.bracket_token.surround(tokens, |tokens| {
inner_attrs_to_tokens(&self.attrs, tokens);
self.elems.to_tokens(tokens);
- });
+ })
}
}
@@ -2958,7 +2930,7 @@ pub(crate) mod printing {
self.func.to_tokens(tokens);
self.paren_token.surround(tokens, |tokens| {
self.args.to_tokens(tokens);
- });
+ })
}
}
@@ -3012,7 +2984,7 @@ pub(crate) mod printing {
if self.elems.len() == 1 && !self.elems.trailing_punct() {
<Token![,]>::default().to_tokens(tokens);
}
- });
+ })
}
}
@@ -3223,8 +3195,8 @@ pub(crate) mod printing {
impl ToTokens for ExprClosure {
fn to_tokens(&self, tokens: &mut TokenStream) {
outer_attrs_to_tokens(&self.attrs, tokens);
- self.movability.to_tokens(tokens);
self.asyncness.to_tokens(tokens);
+ self.movability.to_tokens(tokens);
self.capture.to_tokens(tokens);
self.or1_token.to_tokens(tokens);
self.inputs.to_tokens(tokens);
@@ -3410,7 +3382,7 @@ pub(crate) mod printing {
Token![..](Span::call_site()).to_tokens(tokens);
}
self.rest.to_tokens(tokens);
- });
+ })
}
}
@@ -3424,7 +3396,7 @@ pub(crate) mod printing {
self.expr.to_tokens(tokens);
self.semi_token.to_tokens(tokens);
self.len.to_tokens(tokens);
- });
+ })
}
}
diff --git a/src/gen/clone.rs b/src/gen/clone.rs
index 1c8814d6..37670f22 100644
--- a/src/gen/clone.rs
+++ b/src/gen/clone.rs
@@ -412,8 +412,8 @@ impl Clone for ExprClosure {
fn clone(&self) -> Self {
ExprClosure {
attrs: self.attrs.clone(),
- movability: self.movability.clone(),
asyncness: self.asyncness.clone(),
+ movability: self.movability.clone(),
capture: self.capture.clone(),
or1_token: self.or1_token.clone(),
inputs: self.inputs.clone(),
@@ -1662,9 +1662,7 @@ impl Clone for PathArguments {
fn clone(&self) -> Self {
match self {
PathArguments::None => PathArguments::None,
- PathArguments::AngleBracketed(v0) => {
- PathArguments::AngleBracketed(v0.clone())
- }
+ PathArguments::AngleBracketed(v0) => PathArguments::AngleBracketed(v0.clone()),
PathArguments::Parenthesized(v0) => PathArguments::Parenthesized(v0.clone()),
}
}
@@ -1964,7 +1962,9 @@ impl Clone for TypeInfer {
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
impl Clone for TypeMacro {
fn clone(&self) -> Self {
- TypeMacro { mac: self.mac.clone() }
+ TypeMacro {
+ mac: self.mac.clone(),
+ }
}
}
#[cfg(any(feature = "derive", feature = "full"))]
diff --git a/src/gen/debug.rs b/src/gen/debug.rs
index 11e197ea..3efa2788 100644
--- a/src/gen/debug.rs
+++ b/src/gen/debug.rs
@@ -726,8 +726,8 @@ impl Debug for ExprClosure {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
let mut formatter = formatter.debug_struct("ExprClosure");
formatter.field("attrs", &self.attrs);
- formatter.field("movability", &self.movability);
formatter.field("asyncness", &self.asyncness);
+ formatter.field("movability", &self.movability);
formatter.field("capture", &self.capture);
formatter.field("or1_token", &self.or1_token);
formatter.field("inputs", &self.inputs);
diff --git a/src/gen/eq.rs b/src/gen/eq.rs
index 40fed0b8..e6e85323 100644
--- a/src/gen/eq.rs
+++ b/src/gen/eq.rs
@@ -31,8 +31,11 @@ impl Eq for Arm {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for Arm {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.pat == other.pat && self.guard == other.guard
- && self.body == other.body && self.comma == other.comma
+ self.attrs == other.attrs
+ && self.pat == other.pat
+ && self.guard == other.guard
+ && self.body == other.body
+ && self.comma == other.comma
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -56,7 +59,8 @@ impl Eq for Attribute {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for Attribute {
fn eq(&self, other: &Self) -> bool {
- self.style == other.style && self.path == other.path
+ self.style == other.style
+ && self.path == other.path
&& TokenStreamHelper(&self.tokens) == TokenStreamHelper(&other.tokens)
}
}
@@ -147,8 +151,11 @@ impl Eq for ConstParam {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ConstParam {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.ident == other.ident && self.ty == other.ty
- && self.eq_token == other.eq_token && self.default == other.default
+ self.attrs == other.attrs
+ && self.ident == other.ident
+ && self.ty == other.ty
+ && self.eq_token == other.eq_token
+ && self.default == other.default
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -213,8 +220,11 @@ impl Eq for DeriveInput {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for DeriveInput {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis && self.ident == other.ident
- && self.generics == other.generics && self.data == other.data
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.ident == other.ident
+ && self.generics == other.generics
+ && self.data == other.data
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -328,7 +338,9 @@ impl Eq for ExprAssignOp {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprAssignOp {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.left == other.left && self.op == other.op
+ self.attrs == other.attrs
+ && self.left == other.left
+ && self.op == other.op
&& self.right == other.right
}
}
@@ -339,8 +351,7 @@ impl Eq for ExprAsync {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprAsync {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.capture == other.capture
- && self.block == other.block
+ self.attrs == other.attrs && self.capture == other.capture && self.block == other.block
}
}
#[cfg(feature = "full")]
@@ -360,7 +371,9 @@ impl Eq for ExprBinary {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprBinary {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.left == other.left && self.op == other.op
+ self.attrs == other.attrs
+ && self.left == other.left
+ && self.op == other.op
&& self.right == other.right
}
}
@@ -371,8 +384,7 @@ impl Eq for ExprBlock {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprBlock {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.label == other.label
- && self.block == other.block
+ self.attrs == other.attrs && self.label == other.label && self.block == other.block
}
}
#[cfg(feature = "full")]
@@ -422,9 +434,12 @@ impl Eq for ExprClosure {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprClosure {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.movability == other.movability
- && self.asyncness == other.asyncness && self.capture == other.capture
- && self.inputs == other.inputs && self.output == other.output
+ self.attrs == other.attrs
+ && self.asyncness == other.asyncness
+ && self.movability == other.movability
+ && self.capture == other.capture
+ && self.inputs == other.inputs
+ && self.output == other.output
&& self.body == other.body
}
}
@@ -445,8 +460,7 @@ impl Eq for ExprField {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprField {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.base == other.base
- && self.member == other.member
+ self.attrs == other.attrs && self.base == other.base && self.member == other.member
}
}
#[cfg(feature = "full")]
@@ -456,8 +470,11 @@ impl Eq for ExprForLoop {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprForLoop {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.label == other.label && self.pat == other.pat
- && self.expr == other.expr && self.body == other.body
+ self.attrs == other.attrs
+ && self.label == other.label
+ && self.pat == other.pat
+ && self.expr == other.expr
+ && self.body == other.body
}
}
#[cfg(feature = "full")]
@@ -477,7 +494,8 @@ impl Eq for ExprIf {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprIf {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.cond == other.cond
+ self.attrs == other.attrs
+ && self.cond == other.cond
&& self.then_branch == other.then_branch
&& self.else_branch == other.else_branch
}
@@ -549,8 +567,10 @@ impl Eq for ExprMethodCall {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprMethodCall {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.receiver == other.receiver
- && self.method == other.method && self.turbofish == other.turbofish
+ self.attrs == other.attrs
+ && self.receiver == other.receiver
+ && self.method == other.method
+ && self.turbofish == other.turbofish
&& self.args == other.args
}
}
@@ -581,8 +601,10 @@ impl Eq for ExprRange {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprRange {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.from == other.from
- && self.limits == other.limits && self.to == other.to
+ self.attrs == other.attrs
+ && self.from == other.from
+ && self.limits == other.limits
+ && self.to == other.to
}
}
#[cfg(feature = "full")]
@@ -592,8 +614,7 @@ impl Eq for ExprReference {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprReference {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.mutability == other.mutability
- && self.expr == other.expr
+ self.attrs == other.attrs && self.mutability == other.mutability && self.expr == other.expr
}
}
#[cfg(feature = "full")]
@@ -623,8 +644,10 @@ impl Eq for ExprStruct {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprStruct {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.path == other.path
- && self.fields == other.fields && self.dot2_token == other.dot2_token
+ self.attrs == other.attrs
+ && self.path == other.path
+ && self.fields == other.fields
+ && self.dot2_token == other.dot2_token
&& self.rest == other.rest
}
}
@@ -695,7 +718,9 @@ impl Eq for ExprWhile {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ExprWhile {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.label == other.label && self.cond == other.cond
+ self.attrs == other.attrs
+ && self.label == other.label
+ && self.cond == other.cond
&& self.body == other.body
}
}
@@ -716,8 +741,11 @@ impl Eq for Field {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for Field {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis && self.ident == other.ident
- && self.colon_token == other.colon_token && self.ty == other.ty
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.ident == other.ident
+ && self.colon_token == other.colon_token
+ && self.ty == other.ty
}
}
#[cfg(feature = "full")]
@@ -727,8 +755,10 @@ impl Eq for FieldPat {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for FieldPat {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.member == other.member
- && self.colon_token == other.colon_token && self.pat == other.pat
+ self.attrs == other.attrs
+ && self.member == other.member
+ && self.colon_token == other.colon_token
+ && self.pat == other.pat
}
}
#[cfg(feature = "full")]
@@ -738,8 +768,10 @@ impl Eq for FieldValue {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for FieldValue {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.member == other.member
- && self.colon_token == other.colon_token && self.expr == other.expr
+ self.attrs == other.attrs
+ && self.member == other.member
+ && self.colon_token == other.colon_token
+ && self.expr == other.expr
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -784,8 +816,7 @@ impl Eq for File {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for File {
fn eq(&self, other: &Self) -> bool {
- self.shebang == other.shebang && self.attrs == other.attrs
- && self.items == other.items
+ self.shebang == other.shebang && self.attrs == other.attrs && self.items == other.items
}
}
#[cfg(feature = "full")]
@@ -838,8 +869,7 @@ impl Eq for ForeignItemMacro {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ForeignItemMacro {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.mac == other.mac
- && self.semi_token == other.semi_token
+ self.attrs == other.attrs && self.mac == other.mac && self.semi_token == other.semi_token
}
}
#[cfg(feature = "full")]
@@ -849,8 +879,10 @@ impl Eq for ForeignItemStatic {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ForeignItemStatic {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis
- && self.mutability == other.mutability && self.ident == other.ident
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.mutability == other.mutability
+ && self.ident == other.ident
&& self.ty == other.ty
}
}
@@ -875,18 +907,12 @@ impl PartialEq for GenericArgument {
(GenericArgument::Lifetime(self0), GenericArgument::Lifetime(other0)) => {
self0 == other0
}
- (GenericArgument::Type(self0), GenericArgument::Type(other0)) => {
- self0 == other0
- }
- (GenericArgument::Binding(self0), GenericArgument::Binding(other0)) => {
- self0 == other0
- }
+ (GenericArgument::Type(self0), GenericArgument::Type(other0)) => self0 == other0,
+ (GenericArgument::Binding(self0), GenericArgument::Binding(other0)) => self0 == other0,
(GenericArgument::Constraint(self0), GenericArgument::Constraint(other0)) => {
self0 == other0
}
- (GenericArgument::Const(self0), GenericArgument::Const(other0)) => {
- self0 == other0
- }
+ (GenericArgument::Const(self0), GenericArgument::Const(other0)) => self0 == other0,
_ => false,
}
}
@@ -902,10 +928,9 @@ impl PartialEq for GenericMethodArgument {
(GenericMethodArgument::Type(self0), GenericMethodArgument::Type(other0)) => {
self0 == other0
}
- (
- GenericMethodArgument::Const(self0),
- GenericMethodArgument::Const(other0),
- ) => self0 == other0,
+ (GenericMethodArgument::Const(self0), GenericMethodArgument::Const(other0)) => {
+ self0 == other0
+ }
_ => false,
}
}
@@ -919,9 +944,7 @@ impl PartialEq for GenericParam {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(GenericParam::Type(self0), GenericParam::Type(other0)) => self0 == other0,
- (GenericParam::Lifetime(self0), GenericParam::Lifetime(other0)) => {
- self0 == other0
- }
+ (GenericParam::Lifetime(self0), GenericParam::Lifetime(other0)) => self0 == other0,
(GenericParam::Const(self0), GenericParam::Const(other0)) => self0 == other0,
_ => false,
}
@@ -934,8 +957,10 @@ impl Eq for Generics {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for Generics {
fn eq(&self, other: &Self) -> bool {
- self.lt_token == other.lt_token && self.params == other.params
- && self.gt_token == other.gt_token && self.where_clause == other.where_clause
+ self.lt_token == other.lt_token
+ && self.params == other.params
+ && self.gt_token == other.gt_token
+ && self.where_clause == other.where_clause
}
}
#[cfg(feature = "full")]
@@ -964,9 +989,12 @@ impl Eq for ImplItemConst {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ImplItemConst {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis
- && self.defaultness == other.defaultness && self.ident == other.ident
- && self.ty == other.ty && self.expr == other.expr
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.defaultness == other.defaultness
+ && self.ident == other.ident
+ && self.ty == other.ty
+ && self.expr == other.expr
}
}
#[cfg(feature = "full")]
@@ -976,8 +1004,7 @@ impl Eq for ImplItemMacro {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ImplItemMacro {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.mac == other.mac
- && self.semi_token == other.semi_token
+ self.attrs == other.attrs && self.mac == other.mac && self.semi_token == other.semi_token
}
}
#[cfg(feature = "full")]
@@ -987,8 +1014,10 @@ impl Eq for ImplItemMethod {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ImplItemMethod {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis
- && self.defaultness == other.defaultness && self.sig == other.sig
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.defaultness == other.defaultness
+ && self.sig == other.sig
&& self.block == other.block
}
}
@@ -999,9 +1028,12 @@ impl Eq for ImplItemType {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ImplItemType {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis
- && self.defaultness == other.defaultness && self.ident == other.ident
- && self.generics == other.generics && self.ty == other.ty
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.defaultness == other.defaultness
+ && self.ident == other.ident
+ && self.generics == other.generics
+ && self.ty == other.ty
}
}
#[cfg(feature = "full")]
@@ -1042,8 +1074,11 @@ impl Eq for ItemConst {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemConst {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis && self.ident == other.ident
- && self.ty == other.ty && self.expr == other.expr
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.ident == other.ident
+ && self.ty == other.ty
+ && self.expr == other.expr
}
}
#[cfg(feature = "full")]
@@ -1053,8 +1088,11 @@ impl Eq for ItemEnum {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemEnum {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis && self.ident == other.ident
- && self.generics == other.generics && self.variants == other.variants
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.ident == other.ident
+ && self.generics == other.generics
+ && self.variants == other.variants
}
}
#[cfg(feature = "full")]
@@ -1064,7 +1102,9 @@ impl Eq for ItemExternCrate {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemExternCrate {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis && self.ident == other.ident
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.ident == other.ident
&& self.rename == other.rename
}
}
@@ -1075,7 +1115,9 @@ impl Eq for ItemFn {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemFn {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis && self.sig == other.sig
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.sig == other.sig
&& self.block == other.block
}
}
@@ -1096,9 +1138,12 @@ impl Eq for ItemImpl {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemImpl {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.defaultness == other.defaultness
- && self.unsafety == other.unsafety && self.generics == other.generics
- && self.trait_ == other.trait_ && self.self_ty == other.self_ty
+ self.attrs == other.attrs
+ && self.defaultness == other.defaultness
+ && self.unsafety == other.unsafety
+ && self.generics == other.generics
+ && self.trait_ == other.trait_
+ && self.self_ty == other.self_ty
&& self.items == other.items
}
}
@@ -1109,7 +1154,9 @@ impl Eq for ItemMacro {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemMacro {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.ident == other.ident && self.mac == other.mac
+ self.attrs == other.attrs
+ && self.ident == other.ident
+ && self.mac == other.mac
&& self.semi_token == other.semi_token
}
}
@@ -1120,7 +1167,9 @@ impl Eq for ItemMacro2 {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemMacro2 {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis && self.ident == other.ident
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.ident == other.ident
&& TokenStreamHelper(&self.rules) == TokenStreamHelper(&other.rules)
}
}
@@ -1131,8 +1180,11 @@ impl Eq for ItemMod {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemMod {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis && self.ident == other.ident
- && self.content == other.content && self.semi == other.semi
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.ident == other.ident
+ && self.content == other.content
+ && self.semi == other.semi
}
}
#[cfg(feature = "full")]
@@ -1142,9 +1194,12 @@ impl Eq for ItemStatic {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemStatic {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis
- && self.mutability == other.mutability && self.ident == other.ident
- && self.ty == other.ty && self.expr == other.expr
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.mutability == other.mutability
+ && self.ident == other.ident
+ && self.ty == other.ty
+ && self.expr == other.expr
}
}
#[cfg(feature = "full")]
@@ -1154,8 +1209,11 @@ impl Eq for ItemStruct {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemStruct {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis && self.ident == other.ident
- && self.generics == other.generics && self.fields == other.fields
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.ident == other.ident
+ && self.generics == other.generics
+ && self.fields == other.fields
&& self.semi_token == other.semi_token
}
}
@@ -1166,11 +1224,15 @@ impl Eq for ItemTrait {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemTrait {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis
- && self.unsafety == other.unsafety && self.auto_token == other.auto_token
- && self.ident == other.ident && self.generics == other.generics
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.unsafety == other.unsafety
+ && self.auto_token == other.auto_token
+ && self.ident == other.ident
+ && self.generics == other.generics
&& self.colon_token == other.colon_token
- && self.supertraits == other.supertraits && self.items == other.items
+ && self.supertraits == other.supertraits
+ && self.items == other.items
}
}
#[cfg(feature = "full")]
@@ -1180,8 +1242,11 @@ impl Eq for ItemTraitAlias {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemTraitAlias {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis && self.ident == other.ident
- && self.generics == other.generics && self.bounds == other.bounds
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.ident == other.ident
+ && self.generics == other.generics
+ && self.bounds == other.bounds
}
}
#[cfg(feature = "full")]
@@ -1191,8 +1256,11 @@ impl Eq for ItemType {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemType {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis && self.ident == other.ident
- && self.generics == other.generics && self.ty == other.ty
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.ident == other.ident
+ && self.generics == other.generics
+ && self.ty == other.ty
}
}
#[cfg(feature = "full")]
@@ -1202,8 +1270,11 @@ impl Eq for ItemUnion {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemUnion {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis && self.ident == other.ident
- && self.generics == other.generics && self.fields == other.fields
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.ident == other.ident
+ && self.generics == other.generics
+ && self.fields == other.fields
}
}
#[cfg(feature = "full")]
@@ -1213,8 +1284,10 @@ impl Eq for ItemUse {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for ItemUse {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.vis == other.vis
- && self.leading_colon == other.leading_colon && self.tree == other.tree
+ self.attrs == other.attrs
+ && self.vis == other.vis
+ && self.leading_colon == other.leading_colon
+ && self.tree == other.tree
}
}
#[cfg(feature = "full")]
@@ -1234,8 +1307,10 @@ impl Eq for LifetimeDef {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for LifetimeDef {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.lifetime == other.lifetime
- && self.colon_token == other.colon_token && self.bounds == other.bounds
+ self.attrs == other.attrs
+ && self.lifetime == other.lifetime
+ && self.colon_token == other.colon_token
+ && self.bounds == other.bounds
}
}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
@@ -1295,7 +1370,8 @@ impl Eq for Macro {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for Macro {
fn eq(&self, other: &Self) -> bool {
- self.path == other.path && self.delimiter == other.delimiter
+ self.path == other.path
+ && self.delimiter == other.delimiter
&& TokenStreamHelper(&self.tokens) == TokenStreamHelper(&other.tokens)
}
}
@@ -1430,8 +1506,10 @@ impl Eq for PatIdent {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for PatIdent {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.by_ref == other.by_ref
- && self.mutability == other.mutability && self.ident == other.ident
+ self.attrs == other.attrs
+ && self.by_ref == other.by_ref
+ && self.mutability == other.mutability
+ && self.ident == other.ident
&& self.subpat == other.subpat
}
}
@@ -1462,7 +1540,8 @@ impl Eq for PatOr {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for PatOr {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.leading_vert == other.leading_vert
+ self.attrs == other.attrs
+ && self.leading_vert == other.leading_vert
&& self.cases == other.cases
}
}
@@ -1483,7 +1562,9 @@ impl Eq for PatRange {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for PatRange {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.lo == other.lo && self.limits == other.limits
+ self.attrs == other.attrs
+ && self.lo == other.lo
+ && self.limits == other.limits
&& self.hi == other.hi
}
}
@@ -1494,8 +1575,7 @@ impl Eq for PatReference {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for PatReference {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.mutability == other.mutability
- && self.pat == other.pat
+ self.attrs == other.attrs && self.mutability == other.mutability && self.pat == other.pat
}
}
#[cfg(feature = "full")]
@@ -1525,8 +1605,10 @@ impl Eq for PatStruct {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for PatStruct {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.path == other.path
- && self.fields == other.fields && self.dot2_token == other.dot2_token
+ self.attrs == other.attrs
+ && self.path == other.path
+ && self.fields == other.fields
+ && self.dot2_token == other.dot2_token
}
}
#[cfg(feature = "full")]
@@ -1588,14 +1670,12 @@ impl PartialEq for PathArguments {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(PathArguments::None, PathArguments::None) => true,
- (
- PathArguments::AngleBracketed(self0),
- PathArguments::AngleBracketed(other0),
- ) => self0 == other0,
- (
- PathArguments::Parenthesized(self0),
- PathArguments::Parenthesized(other0),
- ) => self0 == other0,
+ (PathArguments::AngleBracketed(self0), PathArguments::AngleBracketed(other0)) => {
+ self0 == other0
+ }
+ (PathArguments::Parenthesized(self0), PathArguments::Parenthesized(other0)) => {
+ self0 == other0
+ }
_ => false,
}
}
@@ -1637,7 +1717,8 @@ impl Eq for PredicateType {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for PredicateType {
fn eq(&self, other: &Self) -> bool {
- self.lifetimes == other.lifetimes && self.bounded_ty == other.bounded_ty
+ self.lifetimes == other.lifetimes
+ && self.bounded_ty == other.bounded_ty
&& self.bounds == other.bounds
}
}
@@ -1648,8 +1729,7 @@ impl Eq for QSelf {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for QSelf {
fn eq(&self, other: &Self) -> bool {
- self.ty == other.ty && self.position == other.position
- && self.as_token == other.as_token
+ self.ty == other.ty && self.position == other.position && self.as_token == other.as_token
}
}
#[cfg(feature = "full")]
@@ -1673,7 +1753,8 @@ impl Eq for Receiver {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for Receiver {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.reference == other.reference
+ self.attrs == other.attrs
+ && self.reference == other.reference
&& self.mutability == other.mutability
}
}
@@ -1698,10 +1779,14 @@ impl Eq for Signature {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for Signature {
fn eq(&self, other: &Self) -> bool {
- self.constness == other.constness && self.asyncness == other.asyncness
- && self.unsafety == other.unsafety && self.abi == other.abi
- && self.ident == other.ident && self.generics == other.generics
- && self.inputs == other.inputs && self.variadic == other.variadic
+ self.constness == other.constness
+ && self.asyncness == other.asyncness
+ && self.unsafety == other.unsafety
+ && self.abi == other.abi
+ && self.ident == other.ident
+ && self.generics == other.generics
+ && self.inputs == other.inputs
+ && self.variadic == other.variadic
&& self.output == other.output
}
}
@@ -1728,8 +1813,10 @@ impl Eq for TraitBound {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for TraitBound {
fn eq(&self, other: &Self) -> bool {
- self.paren_token == other.paren_token && self.modifier == other.modifier
- && self.lifetimes == other.lifetimes && self.path == other.path
+ self.paren_token == other.paren_token
+ && self.modifier == other.modifier
+ && self.lifetimes == other.lifetimes
+ && self.path == other.path
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -1772,7 +1859,9 @@ impl Eq for TraitItemConst {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for TraitItemConst {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.ident == other.ident && self.ty == other.ty
+ self.attrs == other.attrs
+ && self.ident == other.ident
+ && self.ty == other.ty
&& self.default == other.default
}
}
@@ -1783,8 +1872,7 @@ impl Eq for TraitItemMacro {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for TraitItemMacro {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.mac == other.mac
- && self.semi_token == other.semi_token
+ self.attrs == other.attrs && self.mac == other.mac && self.semi_token == other.semi_token
}
}
#[cfg(feature = "full")]
@@ -1794,8 +1882,10 @@ impl Eq for TraitItemMethod {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for TraitItemMethod {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.sig == other.sig
- && self.default == other.default && self.semi_token == other.semi_token
+ self.attrs == other.attrs
+ && self.sig == other.sig
+ && self.default == other.default
+ && self.semi_token == other.semi_token
}
}
#[cfg(feature = "full")]
@@ -1805,9 +1895,12 @@ impl Eq for TraitItemType {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for TraitItemType {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.ident == other.ident
- && self.generics == other.generics && self.colon_token == other.colon_token
- && self.bounds == other.bounds && self.default == other.default
+ self.attrs == other.attrs
+ && self.ident == other.ident
+ && self.generics == other.generics
+ && self.colon_token == other.colon_token
+ && self.bounds == other.bounds
+ && self.default == other.default
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -1856,9 +1949,12 @@ impl Eq for TypeBareFn {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for TypeBareFn {
fn eq(&self, other: &Self) -> bool {
- self.lifetimes == other.lifetimes && self.unsafety == other.unsafety
- && self.abi == other.abi && self.inputs == other.inputs
- && self.variadic == other.variadic && self.output == other.output
+ self.lifetimes == other.lifetimes
+ && self.unsafety == other.unsafety
+ && self.abi == other.abi
+ && self.inputs == other.inputs
+ && self.variadic == other.variadic
+ && self.output == other.output
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -1918,9 +2014,12 @@ impl Eq for TypeParam {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for TypeParam {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.ident == other.ident
- && self.colon_token == other.colon_token && self.bounds == other.bounds
- && self.eq_token == other.eq_token && self.default == other.default
+ self.attrs == other.attrs
+ && self.ident == other.ident
+ && self.colon_token == other.colon_token
+ && self.bounds == other.bounds
+ && self.eq_token == other.eq_token
+ && self.default == other.default
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -1931,12 +2030,8 @@ impl Eq for TypeParamBound {}
impl PartialEq for TypeParamBound {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
- (TypeParamBound::Trait(self0), TypeParamBound::Trait(other0)) => {
- self0 == other0
- }
- (TypeParamBound::Lifetime(self0), TypeParamBound::Lifetime(other0)) => {
- self0 == other0
- }
+ (TypeParamBound::Trait(self0), TypeParamBound::Trait(other0)) => self0 == other0,
+ (TypeParamBound::Lifetime(self0), TypeParamBound::Lifetime(other0)) => self0 == other0,
_ => false,
}
}
@@ -1968,7 +2063,8 @@ impl Eq for TypePtr {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for TypePtr {
fn eq(&self, other: &Self) -> bool {
- self.const_token == other.const_token && self.mutability == other.mutability
+ self.const_token == other.const_token
+ && self.mutability == other.mutability
&& self.elem == other.elem
}
}
@@ -1979,7 +2075,8 @@ impl Eq for TypeReference {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for TypeReference {
fn eq(&self, other: &Self) -> bool {
- self.lifetime == other.lifetime && self.mutability == other.mutability
+ self.lifetime == other.lifetime
+ && self.mutability == other.mutability
&& self.elem == other.elem
}
}
@@ -2112,8 +2209,10 @@ impl Eq for Variant {}
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
impl PartialEq for Variant {
fn eq(&self, other: &Self) -> bool {
- self.attrs == other.attrs && self.ident == other.ident
- && self.fields == other.fields && self.discriminant == other.discriminant
+ self.attrs == other.attrs
+ && self.ident == other.ident
+ && self.fields == other.fields
+ && self.discriminant == other.discriminant
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -2156,9 +2255,7 @@ impl PartialEq for Visibility {
match (self, other) {
(Visibility::Public(self0), Visibility::Public(other0)) => self0 == other0,
(Visibility::Crate(self0), Visibility::Crate(other0)) => self0 == other0,
- (Visibility::Restricted(self0), Visibility::Restricted(other0)) => {
- self0 == other0
- }
+ (Visibility::Restricted(self0), Visibility::Restricted(other0)) => self0 == other0,
(Visibility::Inherited, Visibility::Inherited) => true,
_ => false,
}
@@ -2182,12 +2279,8 @@ impl Eq for WherePredicate {}
impl PartialEq for WherePredicate {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
- (WherePredicate::Type(self0), WherePredicate::Type(other0)) => {
- self0 == other0
- }
- (WherePredicate::Lifetime(self0), WherePredicate::Lifetime(other0)) => {
- self0 == other0
- }
+ (WherePredicate::Type(self0), WherePredicate::Type(other0)) => self0 == other0,
+ (WherePredicate::Lifetime(self0), WherePredicate::Lifetime(other0)) => self0 == other0,
(WherePredicate::Eq(self0), WherePredicate::Eq(other0)) => self0 == other0,
_ => false,
}
diff --git a/src/gen/fold.rs b/src/gen/fold.rs
index 7916a620..d9dd32a4 100644
--- a/src/gen/fold.rs
+++ b/src/gen/fold.rs
@@ -18,7 +18,7 @@ macro_rules! full {
#[cfg(all(feature = "derive", not(feature = "full")))]
macro_rules! full {
($e:expr) => {
- unreachable ! ()
+ unreachable!()
};
}
/// Syntax tree traversal to transform the nodes of an owned syntax tree.
@@ -317,10 +317,7 @@ pub trait Fold {
fold_generic_argument(self, i)
}
#[cfg(feature = "full")]
- fn fold_generic_method_argument(
- &mut self,
- i: GenericMethodArgument,
- ) -> GenericMethodArgument {
+ fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
fold_generic_method_argument(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -624,10 +621,7 @@ pub trait Fold {
fold_trait_bound(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
- fn fold_trait_bound_modifier(
- &mut self,
- i: TraitBoundModifier,
- ) -> TraitBoundModifier {
+ fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
fold_trait_bound_modifier(self, i)
}
#[cfg(feature = "full")]
@@ -798,11 +792,10 @@ where
F: Fold + ?Sized,
{
AngleBracketedGenericArguments {
- colon2_token: (node.colon2_token)
- .map(|it| Token![::](tokens_helper(f, &it.spans))),
- lt_token: Token![<](tokens_helper(f, &node.lt_token.spans)),
+ colon2_token: (node.colon2_token).map(|it| Token ! [::](tokens_helper(f, &it.spans))),
+ lt_token: Token ! [<](tokens_helper(f, &node.lt_token.spans)),
args: FoldHelper::lift(node.args, |it| f.fold_generic_argument(it)),
- gt_token: Token![>](tokens_helper(f, &node.gt_token.spans)),
+ gt_token: Token ! [>](tokens_helper(f, &node.gt_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -813,14 +806,15 @@ where
Arm {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
pat: f.fold_pat(node.pat),
- guard: (node.guard)
- .map(|it| (
+ guard: (node.guard).map(|it| {
+ (
Token![if](tokens_helper(f, &(it).0.span)),
Box::new(f.fold_expr(*(it).1)),
- )),
- fat_arrow_token: Token![=>](tokens_helper(f, &node.fat_arrow_token.spans)),
+ )
+ }),
+ fat_arrow_token: Token ! [=>](tokens_helper(f, &node.fat_arrow_token.spans)),
body: Box::new(f.fold_expr(*node.body)),
- comma: (node.comma).map(|it| Token![,](tokens_helper(f, &it.spans))),
+ comma: (node.comma).map(|it| Token ! [,](tokens_helper(f, &it.spans))),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -841,7 +835,7 @@ where
F: Fold + ?Sized,
{
Attribute {
- pound_token: Token![#](tokens_helper(f, &node.pound_token.spans)),
+ pound_token: Token ! [#](tokens_helper(f, &node.pound_token.spans)),
style: f.fold_attr_style(node.style),
bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)),
path: f.fold_path(node.path),
@@ -855,11 +849,12 @@ where
{
BareFnArg {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
- name: (node.name)
- .map(|it| (
+ name: (node.name).map(|it| {
+ (
f.fold_ident((it).0),
- Token![:](tokens_helper(f, &(it).1.spans)),
- )),
+ Token ! [:](tokens_helper(f, &(it).1.spans)),
+ )
+ }),
ty: f.fold_type(node.ty),
}
}
@@ -869,89 +864,47 @@ where
F: Fold + ?Sized,
{
match node {
- BinOp::Add(_binding_0) => {
- BinOp::Add(Token![+](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Sub(_binding_0) => {
- BinOp::Sub(Token![-](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Mul(_binding_0) => {
- BinOp::Mul(Token![*](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Div(_binding_0) => {
- BinOp::Div(Token![/](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Rem(_binding_0) => {
- BinOp::Rem(Token![%](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::And(_binding_0) => {
- BinOp::And(Token![&&](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Or(_binding_0) => {
- BinOp::Or(Token![||](tokens_helper(f, &_binding_0.spans)))
- }
+ BinOp::Add(_binding_0) => BinOp::Add(Token ! [+](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Sub(_binding_0) => BinOp::Sub(Token ! [-](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Mul(_binding_0) => BinOp::Mul(Token ! [*](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Div(_binding_0) => BinOp::Div(Token ! [/](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Rem(_binding_0) => BinOp::Rem(Token ! [%](tokens_helper(f, &_binding_0.spans))),
+ BinOp::And(_binding_0) => BinOp::And(Token ! [&&](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Or(_binding_0) => BinOp::Or(Token ! [||](tokens_helper(f, &_binding_0.spans))),
BinOp::BitXor(_binding_0) => {
- BinOp::BitXor(Token![^](tokens_helper(f, &_binding_0.spans)))
+ BinOp::BitXor(Token ! [^](tokens_helper(f, &_binding_0.spans)))
}
BinOp::BitAnd(_binding_0) => {
- BinOp::BitAnd(Token![&](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::BitOr(_binding_0) => {
- BinOp::BitOr(Token![|](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Shl(_binding_0) => {
- BinOp::Shl(Token![<<](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Shr(_binding_0) => {
- BinOp::Shr(Token![>>](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Eq(_binding_0) => {
- BinOp::Eq(Token![==](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Lt(_binding_0) => {
- BinOp::Lt(Token![<](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Le(_binding_0) => {
- BinOp::Le(Token![<=](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Ne(_binding_0) => {
- BinOp::Ne(Token![!=](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Ge(_binding_0) => {
- BinOp::Ge(Token![>=](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::Gt(_binding_0) => {
- BinOp::Gt(Token![>](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::AddEq(_binding_0) => {
- BinOp::AddEq(Token![+=](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::SubEq(_binding_0) => {
- BinOp::SubEq(Token![-=](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::MulEq(_binding_0) => {
- BinOp::MulEq(Token![*=](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::DivEq(_binding_0) => {
- BinOp::DivEq(Token![/=](tokens_helper(f, &_binding_0.spans)))
- }
- BinOp::RemEq(_binding_0) => {
- BinOp::RemEq(Token![%=](tokens_helper(f, &_binding_0.spans)))
- }
+ BinOp::BitAnd(Token ! [&](tokens_helper(f, &_binding_0.spans)))
+ }
+ BinOp::BitOr(_binding_0) => BinOp::BitOr(Token ! [|](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Shl(_binding_0) => BinOp::Shl(Token ! [<<](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Shr(_binding_0) => BinOp::Shr(Token ! [>>](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Eq(_binding_0) => BinOp::Eq(Token ! [==](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Lt(_binding_0) => BinOp::Lt(Token ! [<](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Le(_binding_0) => BinOp::Le(Token ! [<=](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Ne(_binding_0) => BinOp::Ne(Token ! [!=](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Ge(_binding_0) => BinOp::Ge(Token ! [>=](tokens_helper(f, &_binding_0.spans))),
+ BinOp::Gt(_binding_0) => BinOp::Gt(Token ! [>](tokens_helper(f, &_binding_0.spans))),
+ BinOp::AddEq(_binding_0) => BinOp::AddEq(Token ! [+=](tokens_helper(f, &_binding_0.spans))),
+ BinOp::SubEq(_binding_0) => BinOp::SubEq(Token ! [-=](tokens_helper(f, &_binding_0.spans))),
+ BinOp::MulEq(_binding_0) => BinOp::MulEq(Token ! [*=](tokens_helper(f, &_binding_0.spans))),
+ BinOp::DivEq(_binding_0) => BinOp::DivEq(Token ! [/=](tokens_helper(f, &_binding_0.spans))),
+ BinOp::RemEq(_binding_0) => BinOp::RemEq(Token ! [%=](tokens_helper(f, &_binding_0.spans))),
BinOp::BitXorEq(_binding_0) => {
- BinOp::BitXorEq(Token![^=](tokens_helper(f, &_binding_0.spans)))
+ BinOp::BitXorEq(Token ! [^=](tokens_helper(f, &_binding_0.spans)))
}
BinOp::BitAndEq(_binding_0) => {
- BinOp::BitAndEq(Token![&=](tokens_helper(f, &_binding_0.spans)))
+ BinOp::BitAndEq(Token ! [&=](tokens_helper(f, &_binding_0.spans)))
}
BinOp::BitOrEq(_binding_0) => {
- BinOp::BitOrEq(Token![|=](tokens_helper(f, &_binding_0.spans)))
+ BinOp::BitOrEq(Token ! [|=](tokens_helper(f, &_binding_0.spans)))
}
BinOp::ShlEq(_binding_0) => {
- BinOp::ShlEq(Token![<<=](tokens_helper(f, &_binding_0.spans)))
+ BinOp::ShlEq(Token ! [<<=](tokens_helper(f, &_binding_0.spans)))
}
BinOp::ShrEq(_binding_0) => {
- BinOp::ShrEq(Token![>>=](tokens_helper(f, &_binding_0.spans)))
+ BinOp::ShrEq(Token ! [>>=](tokens_helper(f, &_binding_0.spans)))
}
}
}
@@ -962,7 +915,7 @@ where
{
Binding {
ident: f.fold_ident(node.ident),
- eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
+ eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)),
ty: f.fold_type(node.ty),
}
}
@@ -983,9 +936,9 @@ where
{
BoundLifetimes {
for_token: Token![for](tokens_helper(f, &node.for_token.span)),
- lt_token: Token![<](tokens_helper(f, &node.lt_token.spans)),
+ lt_token: Token ! [<](tokens_helper(f, &node.lt_token.spans)),
lifetimes: FoldHelper::lift(node.lifetimes, |it| f.fold_lifetime_def(it)),
- gt_token: Token![>](tokens_helper(f, &node.gt_token.spans)),
+ gt_token: Token ! [>](tokens_helper(f, &node.gt_token.spans)),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -997,9 +950,9 @@ where
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
const_token: Token![const](tokens_helper(f, &node.const_token.span)),
ident: f.fold_ident(node.ident),
- colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
+ colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)),
ty: f.fold_type(node.ty),
- eq_token: (node.eq_token).map(|it| Token![=](tokens_helper(f, &it.spans))),
+ eq_token: (node.eq_token).map(|it| Token ! [=](tokens_helper(f, &it.spans))),
default: (node.default).map(|it| f.fold_expr(it)),
}
}
@@ -1010,7 +963,7 @@ where
{
Constraint {
ident: f.fold_ident(node.ident),
- colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
+ colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)),
bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
}
}
@@ -1044,7 +997,7 @@ where
DataStruct {
struct_token: Token![struct](tokens_helper(f, &node.struct_token.span)),
fields: f.fold_fields(node.fields),
- semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
+ semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))),
}
}
#[cfg(feature = "derive")]
@@ -1078,9 +1031,7 @@ where
match node {
Expr::Array(_binding_0) => Expr::Array(full!(f.fold_expr_array(_binding_0))),
Expr::Assign(_binding_0) => Expr::Assign(full!(f.fold_expr_assign(_binding_0))),
- Expr::AssignOp(_binding_0) => {
- Expr::AssignOp(full!(f.fold_expr_assign_op(_binding_0)))
- }
+ Expr::AssignOp(_binding_0) => Expr::AssignOp(full!(f.fold_expr_assign_op(_binding_0))),
Expr::Async(_binding_0) => Expr::Async(full!(f.fold_expr_async(_binding_0))),
Expr::Await(_binding_0) => Expr::Await(full!(f.fold_expr_await(_binding_0))),
Expr::Binary(_binding_0) => Expr::Binary(f.fold_expr_binary(_binding_0)),
@@ -1089,16 +1040,10 @@ where
Expr::Break(_binding_0) => Expr::Break(full!(f.fold_expr_break(_binding_0))),
Expr::Call(_binding_0) => Expr::Call(f.fold_expr_call(_binding_0)),
Expr::Cast(_binding_0) => Expr::Cast(f.fold_expr_cast(_binding_0)),
- Expr::Closure(_binding_0) => {
- Expr::Closure(full!(f.fold_expr_closure(_binding_0)))
- }
- Expr::Continue(_binding_0) => {
- Expr::Continue(full!(f.fold_expr_continue(_binding_0)))
- }
+ Expr::Closure(_binding_0) => Expr::Closure(full!(f.fold_expr_closure(_binding_0))),
+ Expr::Continue(_binding_0) => Expr::Continue(full!(f.fold_expr_continue(_binding_0))),
Expr::Field(_binding_0) => Expr::Field(f.fold_expr_field(_binding_0)),
- Expr::ForLoop(_binding_0) => {
- Expr::ForLoop(full!(f.fold_expr_for_loop(_binding_0)))
- }
+ Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(f.fold_expr_for_loop(_binding_0))),
Expr::Group(_binding_0) => Expr::Group(full!(f.fold_expr_group(_binding_0))),
Expr::If(_binding_0) => Expr::If(full!(f.fold_expr_if(_binding_0))),
Expr::Index(_binding_0) => Expr::Index(f.fold_expr_index(_binding_0)),
@@ -1113,16 +1058,12 @@ where
Expr::Paren(_binding_0) => Expr::Paren(f.fold_expr_paren(_binding_0)),
Expr::Path(_binding_0) => Expr::Path(f.fold_expr_path(_binding_0)),
Expr::Range(_binding_0) => Expr::Range(full!(f.fold_expr_range(_binding_0))),
- Expr::Reference(_binding_0) => {
- Expr::Reference(full!(f.fold_expr_reference(_binding_0)))
- }
+ Expr::Reference(_binding_0) => Expr::Reference(full!(f.fold_expr_reference(_binding_0))),
Expr::Repeat(_binding_0) => Expr::Repeat(full!(f.fold_expr_repeat(_binding_0))),
Expr::Return(_binding_0) => Expr::Return(full!(f.fold_expr_return(_binding_0))),
Expr::Struct(_binding_0) => Expr::Struct(full!(f.fold_expr_struct(_binding_0))),
Expr::Try(_binding_0) => Expr::Try(full!(f.fold_expr_try(_binding_0))),
- Expr::TryBlock(_binding_0) => {
- Expr::TryBlock(full!(f.fold_expr_try_block(_binding_0)))
- }
+ Expr::TryBlock(_binding_0) => Expr::TryBlock(full!(f.fold_expr_try_block(_binding_0))),
Expr::Tuple(_binding_0) => Expr::Tuple(full!(f.fold_expr_tuple(_binding_0))),
Expr::Type(_binding_0) => Expr::Type(full!(f.fold_expr_type(_binding_0))),
Expr::Unary(_binding_0) => Expr::Unary(f.fold_expr_unary(_binding_0)),
@@ -1152,7 +1093,7 @@ where
ExprAssign {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
left: Box::new(f.fold_expr(*node.left)),
- eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
+ eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)),
right: Box::new(f.fold_expr(*node.right)),
}
}
@@ -1188,7 +1129,7 @@ where
ExprAwait {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
base: Box::new(f.fold_expr(*node.base)),
- dot_token: Token![.](tokens_helper(f, &node.dot_token.spans)),
+ dot_token: Token ! [.](tokens_helper(f, &node.dot_token.spans)),
await_token: crate::token::Await(tokens_helper(f, &node.await_token.span)),
}
}
@@ -1269,13 +1210,12 @@ where
{
ExprClosure {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
- movability: (node.movability)
- .map(|it| Token![static](tokens_helper(f, &it.span))),
asyncness: (node.asyncness).map(|it| Token![async](tokens_helper(f, &it.span))),
+ movability: (node.movability).map(|it| Token![static](tokens_helper(f, &it.span))),
capture: (node.capture).map(|it| Token![move](tokens_helper(f, &it.span))),
- or1_token: Token![|](tokens_helper(f, &node.or1_token.spans)),
+ or1_token: Token ! [|](tokens_helper(f, &node.or1_token.spans)),
inputs: FoldHelper::lift(node.inputs, |it| f.fold_pat(it)),
- or2_token: Token![|](tokens_helper(f, &node.or2_token.spans)),
+ or2_token: Token ! [|](tokens_helper(f, &node.or2_token.spans)),
output: f.fold_return_type(node.output),
body: Box::new(f.fold_expr(*node.body)),
}
@@ -1299,7 +1239,7 @@ where
ExprField {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
base: Box::new(f.fold_expr(*node.base)),
- dot_token: Token![.](tokens_helper(f, &node.dot_token.spans)),
+ dot_token: Token ! [.](tokens_helper(f, &node.dot_token.spans)),
member: f.fold_member(node.member),
}
}
@@ -1339,11 +1279,12 @@ where
if_token: Token![if](tokens_helper(f, &node.if_token.span)),
cond: Box::new(f.fold_expr(*node.cond)),
then_branch: f.fold_block(node.then_branch),
- else_branch: (node.else_branch)
- .map(|it| (
+ else_branch: (node.else_branch).map(|it| {
+ (
Token![else](tokens_helper(f, &(it).0.span)),
Box::new(f.fold_expr(*(it).1)),
- )),
+ )
+ }),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -1367,7 +1308,7 @@ where
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
let_token: Token![let](tokens_helper(f, &node.let_token.span)),
pat: f.fold_pat(node.pat),
- eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
+ eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)),
expr: Box::new(f.fold_expr(*node.expr)),
}
}
@@ -1424,7 +1365,7 @@ where
ExprMethodCall {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
receiver: Box::new(f.fold_expr(*node.receiver)),
- dot_token: Token![.](tokens_helper(f, &node.dot_token.spans)),
+ dot_token: Token ! [.](tokens_helper(f, &node.dot_token.spans)),
method: f.fold_ident(node.method),
turbofish: (node.turbofish).map(|it| f.fold_method_turbofish(it)),
paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
@@ -1472,7 +1413,7 @@ where
{
ExprReference {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
- and_token: Token![&](tokens_helper(f, &node.and_token.spans)),
+ and_token: Token ! [&](tokens_helper(f, &node.and_token.spans)),
raw: node.raw,
mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
expr: Box::new(f.fold_expr(*node.expr)),
@@ -1487,7 +1428,7 @@ where
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)),
expr: Box::new(f.fold_expr(*node.expr)),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
len: Box::new(f.fold_expr(*node.len)),
}
}
@@ -1524,7 +1465,7 @@ where
ExprTry {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
expr: Box::new(f.fold_expr(*node.expr)),
- question_token: Token![?](tokens_helper(f, &node.question_token.spans)),
+ question_token: Token ! [?](tokens_helper(f, &node.question_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -1557,7 +1498,7 @@ where
ExprType {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
expr: Box::new(f.fold_expr(*node.expr)),
- colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
+ colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)),
ty: Box::new(f.fold_type(*node.ty)),
}
}
@@ -1616,7 +1557,7 @@ where
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
vis: f.fold_visibility(node.vis),
ident: (node.ident).map(|it| f.fold_ident(it)),
- colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
+ colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))),
ty: f.fold_type(node.ty),
}
}
@@ -1628,7 +1569,7 @@ where
FieldPat {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
member: f.fold_member(node.member),
- colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
+ colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))),
pat: Box::new(f.fold_pat(*node.pat)),
}
}
@@ -1640,7 +1581,7 @@ where
FieldValue {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
member: f.fold_member(node.member),
- colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
+ colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))),
expr: f.fold_expr(node.expr),
}
}
@@ -1702,18 +1643,12 @@ where
F: Fold + ?Sized,
{
match node {
- ForeignItem::Fn(_binding_0) => {
- ForeignItem::Fn(f.fold_foreign_item_fn(_binding_0))
- }
+ ForeignItem::Fn(_binding_0) => ForeignItem::Fn(f.fold_foreign_item_fn(_binding_0)),
ForeignItem::Static(_binding_0) => {
ForeignItem::Static(f.fold_foreign_item_static(_binding_0))
}
- ForeignItem::Type(_binding_0) => {
- ForeignItem::Type(f.fold_foreign_item_type(_binding_0))
- }
- ForeignItem::Macro(_binding_0) => {
- ForeignItem::Macro(f.fold_foreign_item_macro(_binding_0))
- }
+ ForeignItem::Type(_binding_0) => ForeignItem::Type(f.fold_foreign_item_type(_binding_0)),
+ ForeignItem::Macro(_binding_0) => ForeignItem::Macro(f.fold_foreign_item_macro(_binding_0)),
ForeignItem::Verbatim(_binding_0) => ForeignItem::Verbatim(_binding_0),
_ => unreachable!(),
}
@@ -1727,7 +1662,7 @@ where
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
vis: f.fold_visibility(node.vis),
sig: f.fold_signature(node.sig),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -1738,14 +1673,11 @@ where
ForeignItemMacro {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
mac: f.fold_macro(node.mac),
- semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
+ semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))),
}
}
#[cfg(feature = "full")]
-pub fn fold_foreign_item_static<F>(
- f: &mut F,
- node: ForeignItemStatic,
-) -> ForeignItemStatic
+pub fn fold_foreign_item_static<F>(f: &mut F, node: ForeignItemStatic) -> ForeignItemStatic
where
F: Fold + ?Sized,
{
@@ -1755,9 +1687,9 @@ where
static_token: Token![static](tokens_helper(f, &node.static_token.span)),
mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
ident: f.fold_ident(node.ident),
- colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
+ colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)),
ty: Box::new(f.fold_type(*node.ty)),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -1770,7 +1702,7 @@ where
vis: f.fold_visibility(node.vis),
type_token: Token![type](tokens_helper(f, &node.type_token.span)),
ident: f.fold_ident(node.ident),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -1782,18 +1714,14 @@ where
GenericArgument::Lifetime(_binding_0) => {
GenericArgument::Lifetime(f.fold_lifetime(_binding_0))
}
- GenericArgument::Type(_binding_0) => {
- GenericArgument::Type(f.fold_type(_binding_0))
- }
+ GenericArgument::Type(_binding_0) => GenericArgument::Type(f.fold_type(_binding_0)),
GenericArgument::Binding(_binding_0) => {
GenericArgument::Binding(f.fold_binding(_binding_0))
}
GenericArgument::Constraint(_binding_0) => {
GenericArgument::Constraint(f.fold_constraint(_binding_0))
}
- GenericArgument::Const(_binding_0) => {
- GenericArgument::Const(f.fold_expr(_binding_0))
- }
+ GenericArgument::Const(_binding_0) => GenericArgument::Const(f.fold_expr(_binding_0)),
}
}
#[cfg(feature = "full")]
@@ -1819,15 +1747,11 @@ where
F: Fold + ?Sized,
{
match node {
- GenericParam::Type(_binding_0) => {
- GenericParam::Type(f.fold_type_param(_binding_0))
- }
+ GenericParam::Type(_binding_0) => GenericParam::Type(f.fold_type_param(_binding_0)),
GenericParam::Lifetime(_binding_0) => {
GenericParam::Lifetime(f.fold_lifetime_def(_binding_0))
}
- GenericParam::Const(_binding_0) => {
- GenericParam::Const(f.fold_const_param(_binding_0))
- }
+ GenericParam::Const(_binding_0) => GenericParam::Const(f.fold_const_param(_binding_0)),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -1836,9 +1760,9 @@ where
F: Fold + ?Sized,
{
Generics {
- lt_token: (node.lt_token).map(|it| Token![<](tokens_helper(f, &it.spans))),
+ lt_token: (node.lt_token).map(|it| Token ! [<](tokens_helper(f, &it.spans))),
params: FoldHelper::lift(node.params, |it| f.fold_generic_param(it)),
- gt_token: (node.gt_token).map(|it| Token![>](tokens_helper(f, &it.spans))),
+ gt_token: (node.gt_token).map(|it| Token ! [>](tokens_helper(f, &it.spans))),
where_clause: (node.where_clause).map(|it| f.fold_where_clause(it)),
}
}
@@ -1857,16 +1781,10 @@ where
F: Fold + ?Sized,
{
match node {
- ImplItem::Const(_binding_0) => {
- ImplItem::Const(f.fold_impl_item_const(_binding_0))
- }
- ImplItem::Method(_binding_0) => {
- ImplItem::Method(f.fold_impl_item_method(_binding_0))
- }
+ ImplItem::Const(_binding_0) => ImplItem::Const(f.fold_impl_item_const(_binding_0)),
+ ImplItem::Method(_binding_0) => ImplItem::Method(f.fold_impl_item_method(_binding_0)),
ImplItem::Type(_binding_0) => ImplItem::Type(f.fold_impl_item_type(_binding_0)),
- ImplItem::Macro(_binding_0) => {
- ImplItem::Macro(f.fold_impl_item_macro(_binding_0))
- }
+ ImplItem::Macro(_binding_0) => ImplItem::Macro(f.fold_impl_item_macro(_binding_0)),
ImplItem::Verbatim(_binding_0) => ImplItem::Verbatim(_binding_0),
_ => unreachable!(),
}
@@ -1879,15 +1797,14 @@ where
ImplItemConst {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
vis: f.fold_visibility(node.vis),
- defaultness: (node.defaultness)
- .map(|it| Token![default](tokens_helper(f, &it.span))),
+ defaultness: (node.defaultness).map(|it| Token![default](tokens_helper(f, &it.span))),
const_token: Token![const](tokens_helper(f, &node.const_token.span)),
ident: f.fold_ident(node.ident),
- colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
+ colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)),
ty: f.fold_type(node.ty),
- eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
+ eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)),
expr: f.fold_expr(node.expr),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -1898,7 +1815,7 @@ where
ImplItemMacro {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
mac: f.fold_macro(node.mac),
- semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
+ semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))),
}
}
#[cfg(feature = "full")]
@@ -1909,8 +1826,7 @@ where
ImplItemMethod {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
vis: f.fold_visibility(node.vis),
- defaultness: (node.defaultness)
- .map(|it| Token![default](tokens_helper(f, &it.span))),
+ defaultness: (node.defaultness).map(|it| Token![default](tokens_helper(f, &it.span))),
sig: f.fold_signature(node.sig),
block: f.fold_block(node.block),
}
@@ -1923,14 +1839,13 @@ where
ImplItemType {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
vis: f.fold_visibility(node.vis),
- defaultness: (node.defaultness)
- .map(|it| Token![default](tokens_helper(f, &it.span))),
+ defaultness: (node.defaultness).map(|it| Token![default](tokens_helper(f, &it.span))),
type_token: Token![type](tokens_helper(f, &node.type_token.span)),
ident: f.fold_ident(node.ident),
generics: f.fold_generics(node.generics),
- eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
+ eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)),
ty: f.fold_type(node.ty),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -1951,13 +1866,9 @@ where
match node {
Item::Const(_binding_0) => Item::Const(f.fold_item_const(_binding_0)),
Item::Enum(_binding_0) => Item::Enum(f.fold_item_enum(_binding_0)),
- Item::ExternCrate(_binding_0) => {
- Item::ExternCrate(f.fold_item_extern_crate(_binding_0))
- }
+ Item::ExternCrate(_binding_0) => Item::ExternCrate(f.fold_item_extern_crate(_binding_0)),
Item::Fn(_binding_0) => Item::Fn(f.fold_item_fn(_binding_0)),
- Item::ForeignMod(_binding_0) => {
- Item::ForeignMod(f.fold_item_foreign_mod(_binding_0))
- }
+ Item::ForeignMod(_binding_0) => Item::ForeignMod(f.fold_item_foreign_mod(_binding_0)),
Item::Impl(_binding_0) => Item::Impl(f.fold_item_impl(_binding_0)),
Item::Macro(_binding_0) => Item::Macro(f.fold_item_macro(_binding_0)),
Item::Macro2(_binding_0) => Item::Macro2(f.fold_item_macro2(_binding_0)),
@@ -1965,9 +1876,7 @@ where
Item::Static(_binding_0) => Item::Static(f.fold_item_static(_binding_0)),
Item::Struct(_binding_0) => Item::Struct(f.fold_item_struct(_binding_0)),
Item::Trait(_binding_0) => Item::Trait(f.fold_item_trait(_binding_0)),
- Item::TraitAlias(_binding_0) => {
- Item::TraitAlias(f.fold_item_trait_alias(_binding_0))
- }
+ Item::TraitAlias(_binding_0) => Item::TraitAlias(f.fold_item_trait_alias(_binding_0)),
Item::Type(_binding_0) => Item::Type(f.fold_item_type(_binding_0)),
Item::Union(_binding_0) => Item::Union(f.fold_item_union(_binding_0)),
Item::Use(_binding_0) => Item::Use(f.fold_item_use(_binding_0)),
@@ -1985,11 +1894,11 @@ where
vis: f.fold_visibility(node.vis),
const_token: Token![const](tokens_helper(f, &node.const_token.span)),
ident: f.fold_ident(node.ident),
- colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
+ colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)),
ty: Box::new(f.fold_type(*node.ty)),
- eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
+ eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)),
expr: Box::new(f.fold_expr(*node.expr)),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -2018,12 +1927,13 @@ where
extern_token: Token![extern](tokens_helper(f, &node.extern_token.span)),
crate_token: Token![crate](tokens_helper(f, &node.crate_token.span)),
ident: f.fold_ident(node.ident),
- rename: (node.rename)
- .map(|it| (
+ rename: (node.rename).map(|it| {
+ (
Token![as](tokens_helper(f, &(it).0.span)),
f.fold_ident((it).1),
- )),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ )
+ }),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -2057,17 +1967,17 @@ where
{
ItemImpl {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
- defaultness: (node.defaultness)
- .map(|it| Token![default](tokens_helper(f, &it.span))),
+ defaultness: (node.defaultness).map(|it| Token![default](tokens_helper(f, &it.span))),
unsafety: (node.unsafety).map(|it| Token![unsafe](tokens_helper(f, &it.span))),
impl_token: Token![impl](tokens_helper(f, &node.impl_token.span)),
generics: f.fold_generics(node.generics),
- trait_: (node.trait_)
- .map(|it| (
+ trait_: (node.trait_).map(|it| {
+ (
((it).0).map(|it| Token![!](tokens_helper(f, &it.spans))),
f.fold_path((it).1),
Token![for](tokens_helper(f, &(it).2.span)),
- )),
+ )
+ }),
self_ty: Box::new(f.fold_type(*node.self_ty)),
brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
items: FoldHelper::lift(node.items, |it| f.fold_impl_item(it)),
@@ -2082,7 +1992,7 @@ where
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
ident: (node.ident).map(|it| f.fold_ident(it)),
mac: f.fold_macro(node.mac),
- semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
+ semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))),
}
}
#[cfg(feature = "full")]
@@ -2108,12 +2018,13 @@ where
vis: f.fold_visibility(node.vis),
mod_token: Token![mod](tokens_helper(f, &node.mod_token.span)),
ident: f.fold_ident(node.ident),
- content: (node.content)
- .map(|it| (
+ content: (node.content).map(|it| {
+ (
Brace(tokens_helper(f, &(it).0.span)),
FoldHelper::lift((it).1, |it| f.fold_item(it)),
- )),
- semi: (node.semi).map(|it| Token![;](tokens_helper(f, &it.spans))),
+ )
+ }),
+ semi: (node.semi).map(|it| Token ! [;](tokens_helper(f, &it.spans))),
}
}
#[cfg(feature = "full")]
@@ -2127,11 +2038,11 @@ where
static_token: Token![static](tokens_helper(f, &node.static_token.span)),
mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
ident: f.fold_ident(node.ident),
- colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
+ colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)),
ty: Box::new(f.fold_type(*node.ty)),
- eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
+ eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)),
expr: Box::new(f.fold_expr(*node.expr)),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -2146,7 +2057,7 @@ where
ident: f.fold_ident(node.ident),
generics: f.fold_generics(node.generics),
fields: f.fold_fields(node.fields),
- semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
+ semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))),
}
}
#[cfg(feature = "full")]
@@ -2162,11 +2073,8 @@ where
trait_token: Token![trait](tokens_helper(f, &node.trait_token.span)),
ident: f.fold_ident(node.ident),
generics: f.fold_generics(node.generics),
- colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
- supertraits: FoldHelper::lift(
- node.supertraits,
- |it| f.fold_type_param_bound(it),
- ),
+ colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))),
+ supertraits: FoldHelper::lift(node.supertraits, |it| f.fold_type_param_bound(it)),
brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
items: FoldHelper::lift(node.items, |it| f.fold_trait_item(it)),
}
@@ -2182,9 +2090,9 @@ where
trait_token: Token![trait](tokens_helper(f, &node.trait_token.span)),
ident: f.fold_ident(node.ident),
generics: f.fold_generics(node.generics),
- eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
+ eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)),
bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -2198,9 +2106,9 @@ where
type_token: Token![type](tokens_helper(f, &node.type_token.span)),
ident: f.fold_ident(node.ident),
generics: f.fold_generics(node.generics),
- eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
+ eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)),
ty: Box::new(f.fold_type(*node.ty)),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -2226,10 +2134,9 @@ where
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
vis: f.fold_visibility(node.vis),
use_token: Token![use](tokens_helper(f, &node.use_token.span)),
- leading_colon: (node.leading_colon)
- .map(|it| Token![::](tokens_helper(f, &it.spans))),
+ leading_colon: (node.leading_colon).map(|it| Token ! [::](tokens_helper(f, &it.spans))),
tree: f.fold_use_tree(node.tree),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -2239,7 +2146,7 @@ where
{
Label {
name: f.fold_lifetime(node.name),
- colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
+ colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)),
}
}
pub fn fold_lifetime<F>(f: &mut F, node: Lifetime) -> Lifetime
@@ -2259,7 +2166,7 @@ where
LifetimeDef {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
lifetime: f.fold_lifetime(node.lifetime),
- colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
+ colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))),
bounds: FoldHelper::lift(node.bounds, |it| f.fold_lifetime(it)),
}
}
@@ -2350,12 +2257,13 @@ where
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
let_token: Token![let](tokens_helper(f, &node.let_token.span)),
pat: f.fold_pat(node.pat),
- init: (node.init)
- .map(|it| (
- Token![=](tokens_helper(f, &(it).0.spans)),
+ init: (node.init).map(|it| {
+ (
+ Token ! [=](tokens_helper(f, &(it).0.spans)),
Box::new(f.fold_expr(*(it).1)),
- )),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ )
+ }),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -2405,9 +2313,7 @@ where
match node {
Meta::Path(_binding_0) => Meta::Path(f.fold_path(_binding_0)),
Meta::List(_binding_0) => Meta::List(f.fold_meta_list(_binding_0)),
- Meta::NameValue(_binding_0) => {
- Meta::NameValue(f.fold_meta_name_value(_binding_0))
- }
+ Meta::NameValue(_binding_0) => Meta::NameValue(f.fold_meta_name_value(_binding_0)),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -2428,7 +2334,7 @@ where
{
MetaNameValue {
path: f.fold_path(node.path),
- eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
+ eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)),
lit: f.fold_lit(node.lit),
}
}
@@ -2438,10 +2344,10 @@ where
F: Fold + ?Sized,
{
MethodTurbofish {
- colon2_token: Token![::](tokens_helper(f, &node.colon2_token.spans)),
- lt_token: Token![<](tokens_helper(f, &node.lt_token.spans)),
+ colon2_token: Token ! [::](tokens_helper(f, &node.colon2_token.spans)),
+ lt_token: Token ! [<](tokens_helper(f, &node.lt_token.spans)),
args: FoldHelper::lift(node.args, |it| f.fold_generic_method_argument(it)),
- gt_token: Token![>](tokens_helper(f, &node.gt_token.spans)),
+ gt_token: Token ! [>](tokens_helper(f, &node.gt_token.spans)),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -2486,9 +2392,7 @@ where
Pat::Slice(_binding_0) => Pat::Slice(f.fold_pat_slice(_binding_0)),
Pat::Struct(_binding_0) => Pat::Struct(f.fold_pat_struct(_binding_0)),
Pat::Tuple(_binding_0) => Pat::Tuple(f.fold_pat_tuple(_binding_0)),
- Pat::TupleStruct(_binding_0) => {
- Pat::TupleStruct(f.fold_pat_tuple_struct(_binding_0))
- }
+ Pat::TupleStruct(_binding_0) => Pat::TupleStruct(f.fold_pat_tuple_struct(_binding_0)),
Pat::Type(_binding_0) => Pat::Type(f.fold_pat_type(_binding_0)),
Pat::Verbatim(_binding_0) => Pat::Verbatim(_binding_0),
Pat::Wild(_binding_0) => Pat::Wild(f.fold_pat_wild(_binding_0)),
@@ -2516,11 +2420,12 @@ where
by_ref: (node.by_ref).map(|it| Token![ref](tokens_helper(f, &it.span))),
mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
ident: f.fold_ident(node.ident),
- subpat: (node.subpat)
- .map(|it| (
- Token![@](tokens_helper(f, &(it).0.spans)),
+ subpat: (node.subpat).map(|it| {
+ (
+ Token ! [@](tokens_helper(f, &(it).0.spans)),
Box::new(f.fold_pat(*(it).1)),
- )),
+ )
+ }),
}
}
#[cfg(feature = "full")]
@@ -2550,8 +2455,7 @@ where
{
PatOr {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
- leading_vert: (node.leading_vert)
- .map(|it| Token![|](tokens_helper(f, &it.spans))),
+ leading_vert: (node.leading_vert).map(|it| Token ! [|](tokens_helper(f, &it.spans))),
cases: FoldHelper::lift(node.cases, |it| f.fold_pat(it)),
}
}
@@ -2585,7 +2489,7 @@ where
{
PatReference {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
- and_token: Token![&](tokens_helper(f, &node.and_token.spans)),
+ and_token: Token ! [&](tokens_helper(f, &node.and_token.spans)),
mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
pat: Box::new(f.fold_pat(*node.pat)),
}
@@ -2654,7 +2558,7 @@ where
PatType {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
pat: Box::new(f.fold_pat(*node.pat)),
- colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
+ colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)),
ty: Box::new(f.fold_type(*node.ty)),
}
}
@@ -2674,8 +2578,7 @@ where
F: Fold + ?Sized,
{
Path {
- leading_colon: (node.leading_colon)
- .map(|it| Token![::](tokens_helper(f, &it.spans))),
+ leading_colon: (node.leading_colon).map(|it| Token ! [::](tokens_helper(f, &it.spans))),
segments: FoldHelper::lift(node.segments, |it| f.fold_path_segment(it)),
}
}
@@ -2687,14 +2590,10 @@ where
match node {
PathArguments::None => PathArguments::None,
PathArguments::AngleBracketed(_binding_0) => {
- PathArguments::AngleBracketed(
- f.fold_angle_bracketed_generic_arguments(_binding_0),
- )
+ PathArguments::AngleBracketed(f.fold_angle_bracketed_generic_arguments(_binding_0))
}
PathArguments::Parenthesized(_binding_0) => {
- PathArguments::Parenthesized(
- f.fold_parenthesized_generic_arguments(_binding_0),
- )
+ PathArguments::Parenthesized(f.fold_parenthesized_generic_arguments(_binding_0))
}
}
}
@@ -2715,21 +2614,18 @@ where
{
PredicateEq {
lhs_ty: f.fold_type(node.lhs_ty),
- eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
+ eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)),
rhs_ty: f.fold_type(node.rhs_ty),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
-pub fn fold_predicate_lifetime<F>(
- f: &mut F,
- node: PredicateLifetime,
-) -> PredicateLifetime
+pub fn fold_predicate_lifetime<F>(f: &mut F, node: PredicateLifetime) -> PredicateLifetime
where
F: Fold + ?Sized,
{
PredicateLifetime {
lifetime: f.fold_lifetime(node.lifetime),
- colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
+ colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)),
bounds: FoldHelper::lift(node.bounds, |it| f.fold_lifetime(it)),
}
}
@@ -2741,7 +2637,7 @@ where
PredicateType {
lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)),
bounded_ty: f.fold_type(node.bounded_ty),
- colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
+ colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)),
bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
}
}
@@ -2751,11 +2647,11 @@ where
F: Fold + ?Sized,
{
QSelf {
- lt_token: Token![<](tokens_helper(f, &node.lt_token.spans)),
+ lt_token: Token ! [<](tokens_helper(f, &node.lt_token.spans)),
ty: Box::new(f.fold_type(*node.ty)),
position: node.position,
as_token: (node.as_token).map(|it| Token![as](tokens_helper(f, &it.span))),
- gt_token: Token![>](tokens_helper(f, &node.gt_token.spans)),
+ gt_token: Token ! [>](tokens_helper(f, &node.gt_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -2768,7 +2664,7 @@ where
RangeLimits::HalfOpen(Token![..](tokens_helper(f, &_binding_0.spans)))
}
RangeLimits::Closed(_binding_0) => {
- RangeLimits::Closed(Token![..=](tokens_helper(f, &_binding_0.spans)))
+ RangeLimits::Closed(Token ! [..=](tokens_helper(f, &_binding_0.spans)))
}
}
}
@@ -2779,11 +2675,12 @@ where
{
Receiver {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
- reference: (node.reference)
- .map(|it| (
- Token![&](tokens_helper(f, &(it).0.spans)),
+ reference: (node.reference).map(|it| {
+ (
+ Token ! [&](tokens_helper(f, &(it).0.spans)),
((it).1).map(|it| f.fold_lifetime(it)),
- )),
+ )
+ }),
mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
self_token: Token![self](tokens_helper(f, &node.self_token.span)),
}
@@ -2795,12 +2692,10 @@ where
{
match node {
ReturnType::Default => ReturnType::Default,
- ReturnType::Type(_binding_0, _binding_1) => {
- ReturnType::Type(
- Token![->](tokens_helper(f, &_binding_0.spans)),
- Box::new(f.fold_type(*_binding_1)),
- )
- }
+ ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
+ Token ! [->](tokens_helper(f, &_binding_0.spans)),
+ Box::new(f.fold_type(*_binding_1)),
+ ),
}
}
#[cfg(feature = "full")]
@@ -2837,12 +2732,10 @@ where
Stmt::Local(_binding_0) => Stmt::Local(f.fold_local(_binding_0)),
Stmt::Item(_binding_0) => Stmt::Item(f.fold_item(_binding_0)),
Stmt::Expr(_binding_0) => Stmt::Expr(f.fold_expr(_binding_0)),
- Stmt::Semi(_binding_0, _binding_1) => {
- Stmt::Semi(
- f.fold_expr(_binding_0),
- Token![;](tokens_helper(f, &_binding_1.spans)),
- )
- }
+ Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
+ f.fold_expr(_binding_0),
+ Token ! [;](tokens_helper(f, &_binding_1.spans)),
+ ),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -2858,17 +2751,14 @@ where
}
}
#[cfg(any(feature = "derive", feature = "full"))]
-pub fn fold_trait_bound_modifier<F>(
- f: &mut F,
- node: TraitBoundModifier,
-) -> TraitBoundModifier
+pub fn fold_trait_bound_modifier<F>(f: &mut F, node: TraitBoundModifier) -> TraitBoundModifier
where
F: Fold + ?Sized,
{
match node {
TraitBoundModifier::None => TraitBoundModifier::None,
TraitBoundModifier::Maybe(_binding_0) => {
- TraitBoundModifier::Maybe(Token![?](tokens_helper(f, &_binding_0.spans)))
+ TraitBoundModifier::Maybe(Token ! [?](tokens_helper(f, &_binding_0.spans)))
}
}
}
@@ -2878,18 +2768,10 @@ where
F: Fold + ?Sized,
{
match node {
- TraitItem::Const(_binding_0) => {
- TraitItem::Const(f.fold_trait_item_const(_binding_0))
- }
- TraitItem::Method(_binding_0) => {
- TraitItem::Method(f.fold_trait_item_method(_binding_0))
- }
- TraitItem::Type(_binding_0) => {
- TraitItem::Type(f.fold_trait_item_type(_binding_0))
- }
- TraitItem::Macro(_binding_0) => {
- TraitItem::Macro(f.fold_trait_item_macro(_binding_0))
- }
+ TraitItem::Const(_binding_0) => TraitItem::Const(f.fold_trait_item_const(_binding_0)),
+ TraitItem::Method(_binding_0) => TraitItem::Method(f.fold_trait_item_method(_binding_0)),
+ TraitItem::Type(_binding_0) => TraitItem::Type(f.fold_trait_item_type(_binding_0)),
+ TraitItem::Macro(_binding_0) => TraitItem::Macro(f.fold_trait_item_macro(_binding_0)),
TraitItem::Verbatim(_binding_0) => TraitItem::Verbatim(_binding_0),
_ => unreachable!(),
}
@@ -2903,11 +2785,15 @@ where
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
const_token: Token![const](tokens_helper(f, &node.const_token.span)),
ident: f.fold_ident(node.ident),
- colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
+ colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)),
ty: f.fold_type(node.ty),
- default: (node.default)
- .map(|it| (Token![=](tokens_helper(f, &(it).0.spans)), f.fold_expr((it).1))),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ default: (node.default).map(|it| {
+ (
+ Token ! [=](tokens_helper(f, &(it).0.spans)),
+ f.fold_expr((it).1),
+ )
+ }),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -2918,7 +2804,7 @@ where
TraitItemMacro {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
mac: f.fold_macro(node.mac),
- semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
+ semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))),
}
}
#[cfg(feature = "full")]
@@ -2930,7 +2816,7 @@ where
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
sig: f.fold_signature(node.sig),
default: (node.default).map(|it| f.fold_block(it)),
- semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
+ semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))),
}
}
#[cfg(feature = "full")]
@@ -2943,11 +2829,15 @@ where
type_token: Token![type](tokens_helper(f, &node.type_token.span)),
ident: f.fold_ident(node.ident),
generics: f.fold_generics(node.generics),
- colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
+ colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))),
bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
- default: (node.default)
- .map(|it| (Token![=](tokens_helper(f, &(it).0.spans)), f.fold_type((it).1))),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ default: (node.default).map(|it| {
+ (
+ Token ! [=](tokens_helper(f, &(it).0.spans)),
+ f.fold_type((it).1),
+ )
+ }),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -2959,9 +2849,7 @@ where
Type::Array(_binding_0) => Type::Array(f.fold_type_array(_binding_0)),
Type::BareFn(_binding_0) => Type::BareFn(f.fold_type_bare_fn(_binding_0)),
Type::Group(_binding_0) => Type::Group(f.fold_type_group(_binding_0)),
- Type::ImplTrait(_binding_0) => {
- Type::ImplTrait(f.fold_type_impl_trait(_binding_0))
- }
+ Type::ImplTrait(_binding_0) => Type::ImplTrait(f.fold_type_impl_trait(_binding_0)),
Type::Infer(_binding_0) => Type::Infer(f.fold_type_infer(_binding_0)),
Type::Macro(_binding_0) => Type::Macro(f.fold_type_macro(_binding_0)),
Type::Never(_binding_0) => Type::Never(f.fold_type_never(_binding_0)),
@@ -2970,9 +2858,7 @@ where
Type::Ptr(_binding_0) => Type::Ptr(f.fold_type_ptr(_binding_0)),
Type::Reference(_binding_0) => Type::Reference(f.fold_type_reference(_binding_0)),
Type::Slice(_binding_0) => Type::Slice(f.fold_type_slice(_binding_0)),
- Type::TraitObject(_binding_0) => {
- Type::TraitObject(f.fold_type_trait_object(_binding_0))
- }
+ Type::TraitObject(_binding_0) => Type::TraitObject(f.fold_type_trait_object(_binding_0)),
Type::Tuple(_binding_0) => Type::Tuple(f.fold_type_tuple(_binding_0)),
Type::Verbatim(_binding_0) => Type::Verbatim(_binding_0),
_ => unreachable!(),
@@ -2986,7 +2872,7 @@ where
TypeArray {
bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)),
elem: Box::new(f.fold_type(*node.elem)),
- semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
+ semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)),
len: f.fold_expr(node.len),
}
}
@@ -3061,9 +2947,9 @@ where
TypeParam {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
ident: f.fold_ident(node.ident),
- colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
+ colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))),
bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
- eq_token: (node.eq_token).map(|it| Token![=](tokens_helper(f, &it.spans))),
+ eq_token: (node.eq_token).map(|it| Token ! [=](tokens_helper(f, &it.spans))),
default: (node.default).map(|it| f.fold_type(it)),
}
}
@@ -3073,9 +2959,7 @@ where
F: Fold + ?Sized,
{
match node {
- TypeParamBound::Trait(_binding_0) => {
- TypeParamBound::Trait(f.fold_trait_bound(_binding_0))
- }
+ TypeParamBound::Trait(_binding_0) => TypeParamBound::Trait(f.fold_trait_bound(_binding_0)),
TypeParamBound::Lifetime(_binding_0) => {
TypeParamBound::Lifetime(f.fold_lifetime(_binding_0))
}
@@ -3107,9 +2991,8 @@ where
F: Fold + ?Sized,
{
TypePtr {
- star_token: Token![*](tokens_helper(f, &node.star_token.spans)),
- const_token: (node.const_token)
- .map(|it| Token![const](tokens_helper(f, &it.span))),
+ star_token: Token ! [*](tokens_helper(f, &node.star_token.spans)),
+ const_token: (node.const_token).map(|it| Token![const](tokens_helper(f, &it.span))),
mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
elem: Box::new(f.fold_type(*node.elem)),
}
@@ -3120,7 +3003,7 @@ where
F: Fold + ?Sized,
{
TypeReference {
- and_token: Token![&](tokens_helper(f, &node.and_token.spans)),
+ and_token: Token ! [&](tokens_helper(f, &node.and_token.spans)),
lifetime: (node.lifetime).map(|it| f.fold_lifetime(it)),
mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
elem: Box::new(f.fold_type(*node.elem)),
@@ -3162,15 +3045,9 @@ where
F: Fold + ?Sized,
{
match node {
- UnOp::Deref(_binding_0) => {
- UnOp::Deref(Token![*](tokens_helper(f, &_binding_0.spans)))
- }
- UnOp::Not(_binding_0) => {
- UnOp::Not(Token![!](tokens_helper(f, &_binding_0.spans)))
- }
- UnOp::Neg(_binding_0) => {
- UnOp::Neg(Token![-](tokens_helper(f, &_binding_0.spans)))
- }
+ UnOp::Deref(_binding_0) => UnOp::Deref(Token ! [*](tokens_helper(f, &_binding_0.spans))),
+ UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(f, &_binding_0.spans))),
+ UnOp::Neg(_binding_0) => UnOp::Neg(Token ! [-](tokens_helper(f, &_binding_0.spans))),
}
}
#[cfg(feature = "full")]
@@ -3179,7 +3056,7 @@ where
F: Fold + ?Sized,
{
UseGlob {
- star_token: Token![*](tokens_helper(f, &node.star_token.spans)),
+ star_token: Token ! [*](tokens_helper(f, &node.star_token.spans)),
}
}
#[cfg(feature = "full")]
@@ -3208,7 +3085,7 @@ where
{
UsePath {
ident: f.fold_ident(node.ident),
- colon2_token: Token![::](tokens_helper(f, &node.colon2_token.spans)),
+ colon2_token: Token ! [::](tokens_helper(f, &node.colon2_token.spans)),
tree: Box::new(f.fold_use_tree(*node.tree)),
}
}
@@ -3243,7 +3120,7 @@ where
{
Variadic {
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
- dots: Token![...](tokens_helper(f, &node.dots.spans)),
+ dots: Token ! [...](tokens_helper(f, &node.dots.spans)),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3255,8 +3132,12 @@ where
attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
ident: f.fold_ident(node.ident),
fields: f.fold_fields(node.fields),
- discriminant: (node.discriminant)
- .map(|it| (Token![=](tokens_helper(f, &(it).0.spans)), f.fold_expr((it).1))),
+ discriminant: (node.discriminant).map(|it| {
+ (
+ Token ! [=](tokens_helper(f, &(it).0.spans)),
+ f.fold_expr((it).1),
+ )
+ }),
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3295,9 +3176,7 @@ where
F: Fold + ?Sized,
{
match node {
- Visibility::Public(_binding_0) => {
- Visibility::Public(f.fold_vis_public(_binding_0))
- }
+ Visibility::Public(_binding_0) => Visibility::Public(f.fold_vis_public(_binding_0)),
Visibility::Crate(_binding_0) => Visibility::Crate(f.fold_vis_crate(_binding_0)),
Visibility::Restricted(_binding_0) => {
Visibility::Restricted(f.fold_vis_restricted(_binding_0))
@@ -3321,14 +3200,10 @@ where
F: Fold + ?Sized,
{
match node {
- WherePredicate::Type(_binding_0) => {
- WherePredicate::Type(f.fold_predicate_type(_binding_0))
- }
+ WherePredicate::Type(_binding_0) => WherePredicate::Type(f.fold_predicate_type(_binding_0)),
WherePredicate::Lifetime(_binding_0) => {
WherePredicate::Lifetime(f.fold_predicate_lifetime(_binding_0))
}
- WherePredicate::Eq(_binding_0) => {
- WherePredicate::Eq(f.fold_predicate_eq(_binding_0))
- }
+ WherePredicate::Eq(_binding_0) => WherePredicate::Eq(f.fold_predicate_eq(_binding_0)),
}
}
diff --git a/src/gen/hash.rs b/src/gen/hash.rs
index 686ed865..7247174a 100644
--- a/src/gen/hash.rs
+++ b/src/gen/hash.rs
@@ -641,8 +641,8 @@ impl Hash for ExprClosure {
H: Hasher,
{
self.attrs.hash(state);
- self.movability.hash(state);
self.asyncness.hash(state);
+ self.movability.hash(state);
self.capture.hash(state);
self.inputs.hash(state);
self.output.hash(state);
@@ -2520,7 +2520,8 @@ impl Hash for TypeInfer {
fn hash<H>(&self, _state: &mut H)
where
H: Hasher,
- {}
+ {
+ }
}
#[cfg(any(feature = "derive", feature = "full"))]
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
@@ -2538,7 +2539,8 @@ impl Hash for TypeNever {
fn hash<H>(&self, _state: &mut H)
where
H: Hasher,
- {}
+ {
+ }
}
#[cfg(any(feature = "derive", feature = "full"))]
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
@@ -2676,7 +2678,8 @@ impl Hash for UseGlob {
fn hash<H>(&self, _state: &mut H)
where
H: Hasher,
- {}
+ {
+ }
}
#[cfg(feature = "full")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
@@ -2780,7 +2783,8 @@ impl Hash for VisCrate {
fn hash<H>(&self, _state: &mut H)
where
H: Hasher,
- {}
+ {
+ }
}
#[cfg(any(feature = "derive", feature = "full"))]
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
@@ -2788,7 +2792,8 @@ impl Hash for VisPublic {
fn hash<H>(&self, _state: &mut H)
where
H: Hasher,
- {}
+ {
+ }
}
#[cfg(any(feature = "derive", feature = "full"))]
#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))]
diff --git a/src/gen/visit.rs b/src/gen/visit.rs
index d84e4310..24d34b74 100644
--- a/src/gen/visit.rs
+++ b/src/gen/visit.rs
@@ -17,7 +17,7 @@ macro_rules! full {
#[cfg(all(feature = "derive", not(feature = "full")))]
macro_rules! full {
($e:expr) => {
- unreachable ! ()
+ unreachable!()
};
}
macro_rules! skip {
@@ -33,746 +33,740 @@ macro_rules! skip {
pub trait Visit<'ast> {
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_abi(&mut self, i: &'ast Abi) {
- visit_abi(self, i);
+ visit_abi(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
- fn visit_angle_bracketed_generic_arguments(
- &mut self,
- i: &'ast AngleBracketedGenericArguments,
- ) {
- visit_angle_bracketed_generic_arguments(self, i);
+ fn visit_angle_bracketed_generic_arguments(&mut self, i: &'ast AngleBracketedGenericArguments) {
+ visit_angle_bracketed_generic_arguments(self, i)
}
#[cfg(feature = "full")]
fn visit_arm(&mut self, i: &'ast Arm) {
- visit_arm(self, i);
+ visit_arm(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_attr_style(&mut self, i: &'ast AttrStyle) {
- visit_attr_style(self, i);
+ visit_attr_style(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_attribute(&mut self, i: &'ast Attribute) {
- visit_attribute(self, i);
+ visit_attribute(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_bare_fn_arg(&mut self, i: &'ast BareFnArg) {
- visit_bare_fn_arg(self, i);
+ visit_bare_fn_arg(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_bin_op(&mut self, i: &'ast BinOp) {
- visit_bin_op(self, i);
+ visit_bin_op(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_binding(&mut self, i: &'ast Binding) {
- visit_binding(self, i);
+ visit_binding(self, i)
}
#[cfg(feature = "full")]
fn visit_block(&mut self, i: &'ast Block) {
- visit_block(self, i);
+ visit_block(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_bound_lifetimes(&mut self, i: &'ast BoundLifetimes) {
- visit_bound_lifetimes(self, i);
+ visit_bound_lifetimes(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_const_param(&mut self, i: &'ast ConstParam) {
- visit_const_param(self, i);
+ visit_const_param(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_constraint(&mut self, i: &'ast Constraint) {
- visit_constraint(self, i);
+ visit_constraint(self, i)
}
#[cfg(feature = "derive")]
fn visit_data(&mut self, i: &'ast Data) {
- visit_data(self, i);
+ visit_data(self, i)
}
#[cfg(feature = "derive")]
fn visit_data_enum(&mut self, i: &'ast DataEnum) {
- visit_data_enum(self, i);
+ visit_data_enum(self, i)
}
#[cfg(feature = "derive")]
fn visit_data_struct(&mut self, i: &'ast DataStruct) {
- visit_data_struct(self, i);
+ visit_data_struct(self, i)
}
#[cfg(feature = "derive")]
fn visit_data_union(&mut self, i: &'ast DataUnion) {
- visit_data_union(self, i);
+ visit_data_union(self, i)
}
#[cfg(feature = "derive")]
fn visit_derive_input(&mut self, i: &'ast DeriveInput) {
- visit_derive_input(self, i);
+ visit_derive_input(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr(&mut self, i: &'ast Expr) {
- visit_expr(self, i);
+ visit_expr(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_array(&mut self, i: &'ast ExprArray) {
- visit_expr_array(self, i);
+ visit_expr_array(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_assign(&mut self, i: &'ast ExprAssign) {
- visit_expr_assign(self, i);
+ visit_expr_assign(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_assign_op(&mut self, i: &'ast ExprAssignOp) {
- visit_expr_assign_op(self, i);
+ visit_expr_assign_op(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_async(&mut self, i: &'ast ExprAsync) {
- visit_expr_async(self, i);
+ visit_expr_async(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_await(&mut self, i: &'ast ExprAwait) {
- visit_expr_await(self, i);
+ visit_expr_await(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_binary(&mut self, i: &'ast ExprBinary) {
- visit_expr_binary(self, i);
+ visit_expr_binary(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_block(&mut self, i: &'ast ExprBlock) {
- visit_expr_block(self, i);
+ visit_expr_block(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_box(&mut self, i: &'ast ExprBox) {
- visit_expr_box(self, i);
+ visit_expr_box(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_break(&mut self, i: &'ast ExprBreak) {
- visit_expr_break(self, i);
+ visit_expr_break(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_call(&mut self, i: &'ast ExprCall) {
- visit_expr_call(self, i);
+ visit_expr_call(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_cast(&mut self, i: &'ast ExprCast) {
- visit_expr_cast(self, i);
+ visit_expr_cast(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_closure(&mut self, i: &'ast ExprClosure) {
- visit_expr_closure(self, i);
+ visit_expr_closure(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_continue(&mut self, i: &'ast ExprContinue) {
- visit_expr_continue(self, i);
+ visit_expr_continue(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_field(&mut self, i: &'ast ExprField) {
- visit_expr_field(self, i);
+ visit_expr_field(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_for_loop(&mut self, i: &'ast ExprForLoop) {
- visit_expr_for_loop(self, i);
+ visit_expr_for_loop(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_group(&mut self, i: &'ast ExprGroup) {
- visit_expr_group(self, i);
+ visit_expr_group(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_if(&mut self, i: &'ast ExprIf) {
- visit_expr_if(self, i);
+ visit_expr_if(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_index(&mut self, i: &'ast ExprIndex) {
- visit_expr_index(self, i);
+ visit_expr_index(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_let(&mut self, i: &'ast ExprLet) {
- visit_expr_let(self, i);
+ visit_expr_let(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_lit(&mut self, i: &'ast ExprLit) {
- visit_expr_lit(self, i);
+ visit_expr_lit(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_loop(&mut self, i: &'ast ExprLoop) {
- visit_expr_loop(self, i);
+ visit_expr_loop(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_macro(&mut self, i: &'ast ExprMacro) {
- visit_expr_macro(self, i);
+ visit_expr_macro(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_match(&mut self, i: &'ast ExprMatch) {
- visit_expr_match(self, i);
+ visit_expr_match(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_method_call(&mut self, i: &'ast ExprMethodCall) {
- visit_expr_method_call(self, i);
+ visit_expr_method_call(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_paren(&mut self, i: &'ast ExprParen) {
- visit_expr_paren(self, i);
+ visit_expr_paren(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_path(&mut self, i: &'ast ExprPath) {
- visit_expr_path(self, i);
+ visit_expr_path(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_range(&mut self, i: &'ast ExprRange) {
- visit_expr_range(self, i);
+ visit_expr_range(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_reference(&mut self, i: &'ast ExprReference) {
- visit_expr_reference(self, i);
+ visit_expr_reference(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_repeat(&mut self, i: &'ast ExprRepeat) {
- visit_expr_repeat(self, i);
+ visit_expr_repeat(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_return(&mut self, i: &'ast ExprReturn) {
- visit_expr_return(self, i);
+ visit_expr_return(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_struct(&mut self, i: &'ast ExprStruct) {
- visit_expr_struct(self, i);
+ visit_expr_struct(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_try(&mut self, i: &'ast ExprTry) {
- visit_expr_try(self, i);
+ visit_expr_try(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_try_block(&mut self, i: &'ast ExprTryBlock) {
- visit_expr_try_block(self, i);
+ visit_expr_try_block(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_tuple(&mut self, i: &'ast ExprTuple) {
- visit_expr_tuple(self, i);
+ visit_expr_tuple(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_type(&mut self, i: &'ast ExprType) {
- visit_expr_type(self, i);
+ visit_expr_type(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_unary(&mut self, i: &'ast ExprUnary) {
- visit_expr_unary(self, i);
+ visit_expr_unary(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_unsafe(&mut self, i: &'ast ExprUnsafe) {
- visit_expr_unsafe(self, i);
+ visit_expr_unsafe(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_while(&mut self, i: &'ast ExprWhile) {
- visit_expr_while(self, i);
+ visit_expr_while(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_yield(&mut self, i: &'ast ExprYield) {
- visit_expr_yield(self, i);
+ visit_expr_yield(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_field(&mut self, i: &'ast Field) {
- visit_field(self, i);
+ visit_field(self, i)
}
#[cfg(feature = "full")]
fn visit_field_pat(&mut self, i: &'ast FieldPat) {
- visit_field_pat(self, i);
+ visit_field_pat(self, i)
}
#[cfg(feature = "full")]
fn visit_field_value(&mut self, i: &'ast FieldValue) {
- visit_field_value(self, i);
+ visit_field_value(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_fields(&mut self, i: &'ast Fields) {
- visit_fields(self, i);
+ visit_fields(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_fields_named(&mut self, i: &'ast FieldsNamed) {
- visit_fields_named(self, i);
+ visit_fields_named(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_fields_unnamed(&mut self, i: &'ast FieldsUnnamed) {
- visit_fields_unnamed(self, i);
+ visit_fields_unnamed(self, i)
}
#[cfg(feature = "full")]
fn visit_file(&mut self, i: &'ast File) {
- visit_file(self, i);
+ visit_file(self, i)
}
#[cfg(feature = "full")]
fn visit_fn_arg(&mut self, i: &'ast FnArg) {
- visit_fn_arg(self, i);
+ visit_fn_arg(self, i)
}
#[cfg(feature = "full")]
fn visit_foreign_item(&mut self, i: &'ast ForeignItem) {
- visit_foreign_item(self, i);
+ visit_foreign_item(self, i)
}
#[cfg(feature = "full")]
fn visit_foreign_item_fn(&mut self, i: &'ast ForeignItemFn) {
- visit_foreign_item_fn(self, i);
+ visit_foreign_item_fn(self, i)
}
#[cfg(feature = "full")]
fn visit_foreign_item_macro(&mut self, i: &'ast ForeignItemMacro) {
- visit_foreign_item_macro(self, i);
+ visit_foreign_item_macro(self, i)
}
#[cfg(feature = "full")]
fn visit_foreign_item_static(&mut self, i: &'ast ForeignItemStatic) {
- visit_foreign_item_static(self, i);
+ visit_foreign_item_static(self, i)
}
#[cfg(feature = "full")]
fn visit_foreign_item_type(&mut self, i: &'ast ForeignItemType) {
- visit_foreign_item_type(self, i);
+ visit_foreign_item_type(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_generic_argument(&mut self, i: &'ast GenericArgument) {
- visit_generic_argument(self, i);
+ visit_generic_argument(self, i)
}
#[cfg(feature = "full")]
fn visit_generic_method_argument(&mut self, i: &'ast GenericMethodArgument) {
- visit_generic_method_argument(self, i);
+ visit_generic_method_argument(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_generic_param(&mut self, i: &'ast GenericParam) {
- visit_generic_param(self, i);
+ visit_generic_param(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_generics(&mut self, i: &'ast Generics) {
- visit_generics(self, i);
+ visit_generics(self, i)
}
fn visit_ident(&mut self, i: &'ast Ident) {
- visit_ident(self, i);
+ visit_ident(self, i)
}
#[cfg(feature = "full")]
fn visit_impl_item(&mut self, i: &'ast ImplItem) {
- visit_impl_item(self, i);
+ visit_impl_item(self, i)
}
#[cfg(feature = "full")]
fn visit_impl_item_const(&mut self, i: &'ast ImplItemConst) {
- visit_impl_item_const(self, i);
+ visit_impl_item_const(self, i)
}
#[cfg(feature = "full")]
fn visit_impl_item_macro(&mut self, i: &'ast ImplItemMacro) {
- visit_impl_item_macro(self, i);
+ visit_impl_item_macro(self, i)
}
#[cfg(feature = "full")]
fn visit_impl_item_method(&mut self, i: &'ast ImplItemMethod) {
- visit_impl_item_method(self, i);
+ visit_impl_item_method(self, i)
}
#[cfg(feature = "full")]
fn visit_impl_item_type(&mut self, i: &'ast ImplItemType) {
- visit_impl_item_type(self, i);
+ visit_impl_item_type(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_index(&mut self, i: &'ast Index) {
- visit_index(self, i);
+ visit_index(self, i)
}
#[cfg(feature = "full")]
fn visit_item(&mut self, i: &'ast Item) {
- visit_item(self, i);
+ visit_item(self, i)
}
#[cfg(feature = "full")]
fn visit_item_const(&mut self, i: &'ast ItemConst) {
- visit_item_const(self, i);
+ visit_item_const(self, i)
}
#[cfg(feature = "full")]
fn visit_item_enum(&mut self, i: &'ast ItemEnum) {
- visit_item_enum(self, i);
+ visit_item_enum(self, i)
}
#[cfg(feature = "full")]
fn visit_item_extern_crate(&mut self, i: &'ast ItemExternCrate) {
- visit_item_extern_crate(self, i);
+ visit_item_extern_crate(self, i)
}
#[cfg(feature = "full")]
fn visit_item_fn(&mut self, i: &'ast ItemFn) {
- visit_item_fn(self, i);
+ visit_item_fn(self, i)
}
#[cfg(feature = "full")]
fn visit_item_foreign_mod(&mut self, i: &'ast ItemForeignMod) {
- visit_item_foreign_mod(self, i);
+ visit_item_foreign_mod(self, i)
}
#[cfg(feature = "full")]
fn visit_item_impl(&mut self, i: &'ast ItemImpl) {
- visit_item_impl(self, i);
+ visit_item_impl(self, i)
}
#[cfg(feature = "full")]
fn visit_item_macro(&mut self, i: &'ast ItemMacro) {
- visit_item_macro(self, i);
+ visit_item_macro(self, i)
}
#[cfg(feature = "full")]
fn visit_item_macro2(&mut self, i: &'ast ItemMacro2) {
- visit_item_macro2(self, i);
+ visit_item_macro2(self, i)
}
#[cfg(feature = "full")]
fn visit_item_mod(&mut self, i: &'ast ItemMod) {
- visit_item_mod(self, i);
+ visit_item_mod(self, i)
}
#[cfg(feature = "full")]
fn visit_item_static(&mut self, i: &'ast ItemStatic) {
- visit_item_static(self, i);
+ visit_item_static(self, i)
}
#[cfg(feature = "full")]
fn visit_item_struct(&mut self, i: &'ast ItemStruct) {
- visit_item_struct(self, i);
+ visit_item_struct(self, i)
}
#[cfg(feature = "full")]
fn visit_item_trait(&mut self, i: &'ast ItemTrait) {
- visit_item_trait(self, i);
+ visit_item_trait(self, i)
}
#[cfg(feature = "full")]
fn visit_item_trait_alias(&mut self, i: &'ast ItemTraitAlias) {
- visit_item_trait_alias(self, i);
+ visit_item_trait_alias(self, i)
}
#[cfg(feature = "full")]
fn visit_item_type(&mut self, i: &'ast ItemType) {
- visit_item_type(self, i);
+ visit_item_type(self, i)
}
#[cfg(feature = "full")]
fn visit_item_union(&mut self, i: &'ast ItemUnion) {
- visit_item_union(self, i);
+ visit_item_union(self, i)
}
#[cfg(feature = "full")]
fn visit_item_use(&mut self, i: &'ast ItemUse) {
- visit_item_use(self, i);
+ visit_item_use(self, i)
}
#[cfg(feature = "full")]
fn visit_label(&mut self, i: &'ast Label) {
- visit_label(self, i);
+ visit_label(self, i)
}
fn visit_lifetime(&mut self, i: &'ast Lifetime) {
- visit_lifetime(self, i);
+ visit_lifetime(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_lifetime_def(&mut self, i: &'ast LifetimeDef) {
- visit_lifetime_def(self, i);
+ visit_lifetime_def(self, i)
}
fn visit_lit(&mut self, i: &'ast Lit) {
- visit_lit(self, i);
+ visit_lit(self, i)
}
fn visit_lit_bool(&mut self, i: &'ast LitBool) {
- visit_lit_bool(self, i);
+ visit_lit_bool(self, i)
}
fn visit_lit_byte(&mut self, i: &'ast LitByte) {
- visit_lit_byte(self, i);
+ visit_lit_byte(self, i)
}
fn visit_lit_byte_str(&mut self, i: &'ast LitByteStr) {
- visit_lit_byte_str(self, i);
+ visit_lit_byte_str(self, i)
}
fn visit_lit_char(&mut self, i: &'ast LitChar) {
- visit_lit_char(self, i);
+ visit_lit_char(self, i)
}
fn visit_lit_float(&mut self, i: &'ast LitFloat) {
- visit_lit_float(self, i);
+ visit_lit_float(self, i)
}
fn visit_lit_int(&mut self, i: &'ast LitInt) {
- visit_lit_int(self, i);
+ visit_lit_int(self, i)
}
fn visit_lit_str(&mut self, i: &'ast LitStr) {
- visit_lit_str(self, i);
+ visit_lit_str(self, i)
}
#[cfg(feature = "full")]
fn visit_local(&mut self, i: &'ast Local) {
- visit_local(self, i);
+ visit_local(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_macro(&mut self, i: &'ast Macro) {
- visit_macro(self, i);
+ visit_macro(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_macro_delimiter(&mut self, i: &'ast MacroDelimiter) {
- visit_macro_delimiter(self, i);
+ visit_macro_delimiter(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_member(&mut self, i: &'ast Member) {
- visit_member(self, i);
+ visit_member(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_meta(&mut self, i: &'ast Meta) {
- visit_meta(self, i);
+ visit_meta(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_meta_list(&mut self, i: &'ast MetaList) {
- visit_meta_list(self, i);
+ visit_meta_list(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_meta_name_value(&mut self, i: &'ast MetaNameValue) {
- visit_meta_name_value(self, i);
+ visit_meta_name_value(self, i)
}
#[cfg(feature = "full")]
fn visit_method_turbofish(&mut self, i: &'ast MethodTurbofish) {
- visit_method_turbofish(self, i);
+ visit_method_turbofish(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_nested_meta(&mut self, i: &'ast NestedMeta) {
- visit_nested_meta(self, i);
+ visit_nested_meta(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
- fn visit_parenthesized_generic_arguments(
- &mut self,
- i: &'ast ParenthesizedGenericArguments,
- ) {
- visit_parenthesized_generic_arguments(self, i);
+ fn visit_parenthesized_generic_arguments(&mut self, i: &'ast ParenthesizedGenericArguments) {
+ visit_parenthesized_generic_arguments(self, i)
}
#[cfg(feature = "full")]
fn visit_pat(&mut self, i: &'ast Pat) {
- visit_pat(self, i);
+ visit_pat(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_box(&mut self, i: &'ast PatBox) {
- visit_pat_box(self, i);
+ visit_pat_box(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_ident(&mut self, i: &'ast PatIdent) {
- visit_pat_ident(self, i);
+ visit_pat_ident(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_lit(&mut self, i: &'ast PatLit) {
- visit_pat_lit(self, i);
+ visit_pat_lit(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_macro(&mut self, i: &'ast PatMacro) {
- visit_pat_macro(self, i);
+ visit_pat_macro(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_or(&mut self, i: &'ast PatOr) {
- visit_pat_or(self, i);
+ visit_pat_or(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_path(&mut self, i: &'ast PatPath) {
- visit_pat_path(self, i);
+ visit_pat_path(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_range(&mut self, i: &'ast PatRange) {
- visit_pat_range(self, i);
+ visit_pat_range(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_reference(&mut self, i: &'ast PatReference) {
- visit_pat_reference(self, i);
+ visit_pat_reference(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_rest(&mut self, i: &'ast PatRest) {
- visit_pat_rest(self, i);
+ visit_pat_rest(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_slice(&mut self, i: &'ast PatSlice) {
- visit_pat_slice(self, i);
+ visit_pat_slice(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_struct(&mut self, i: &'ast PatStruct) {
- visit_pat_struct(self, i);
+ visit_pat_struct(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_tuple(&mut self, i: &'ast PatTuple) {
- visit_pat_tuple(self, i);
+ visit_pat_tuple(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_tuple_struct(&mut self, i: &'ast PatTupleStruct) {
- visit_pat_tuple_struct(self, i);
+ visit_pat_tuple_struct(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_type(&mut self, i: &'ast PatType) {
- visit_pat_type(self, i);
+ visit_pat_type(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_wild(&mut self, i: &'ast PatWild) {
- visit_pat_wild(self, i);
+ visit_pat_wild(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_path(&mut self, i: &'ast Path) {
- visit_path(self, i);
+ visit_path(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_path_arguments(&mut self, i: &'ast PathArguments) {
- visit_path_arguments(self, i);
+ visit_path_arguments(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_path_segment(&mut self, i: &'ast PathSegment) {
- visit_path_segment(self, i);
+ visit_path_segment(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_predicate_eq(&mut self, i: &'ast PredicateEq) {
- visit_predicate_eq(self, i);
+ visit_predicate_eq(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_predicate_lifetime(&mut self, i: &'ast PredicateLifetime) {
- visit_predicate_lifetime(self, i);
+ visit_predicate_lifetime(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_predicate_type(&mut self, i: &'ast PredicateType) {
- visit_predicate_type(self, i);
+ visit_predicate_type(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_qself(&mut self, i: &'ast QSelf) {
- visit_qself(self, i);
+ visit_qself(self, i)
}
#[cfg(feature = "full")]
fn visit_range_limits(&mut self, i: &'ast RangeLimits) {
- visit_range_limits(self, i);
+ visit_range_limits(self, i)
}
#[cfg(feature = "full")]
fn visit_receiver(&mut self, i: &'ast Receiver) {
- visit_receiver(self, i);
+ visit_receiver(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_return_type(&mut self, i: &'ast ReturnType) {
- visit_return_type(self, i);
+ visit_return_type(self, i)
}
#[cfg(feature = "full")]
fn visit_signature(&mut self, i: &'ast Signature) {
- visit_signature(self, i);
+ visit_signature(self, i)
}
fn visit_span(&mut self, i: &Span) {
- visit_span(self, i);
+ visit_span(self, i)
}
#[cfg(feature = "full")]
fn visit_stmt(&mut self, i: &'ast Stmt) {
- visit_stmt(self, i);
+ visit_stmt(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_trait_bound(&mut self, i: &'ast TraitBound) {
- visit_trait_bound(self, i);
+ visit_trait_bound(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_trait_bound_modifier(&mut self, i: &'ast TraitBoundModifier) {
- visit_trait_bound_modifier(self, i);
+ visit_trait_bound_modifier(self, i)
}
#[cfg(feature = "full")]
fn visit_trait_item(&mut self, i: &'ast TraitItem) {
- visit_trait_item(self, i);
+ visit_trait_item(self, i)
}
#[cfg(feature = "full")]
fn visit_trait_item_const(&mut self, i: &'ast TraitItemConst) {
- visit_trait_item_const(self, i);
+ visit_trait_item_const(self, i)
}
#[cfg(feature = "full")]
fn visit_trait_item_macro(&mut self, i: &'ast TraitItemMacro) {
- visit_trait_item_macro(self, i);
+ visit_trait_item_macro(self, i)
}
#[cfg(feature = "full")]
fn visit_trait_item_method(&mut self, i: &'ast TraitItemMethod) {
- visit_trait_item_method(self, i);
+ visit_trait_item_method(self, i)
}
#[cfg(feature = "full")]
fn visit_trait_item_type(&mut self, i: &'ast TraitItemType) {
- visit_trait_item_type(self, i);
+ visit_trait_item_type(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type(&mut self, i: &'ast Type) {
- visit_type(self, i);
+ visit_type(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_array(&mut self, i: &'ast TypeArray) {
- visit_type_array(self, i);
+ visit_type_array(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_bare_fn(&mut self, i: &'ast TypeBareFn) {
- visit_type_bare_fn(self, i);
+ visit_type_bare_fn(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_group(&mut self, i: &'ast TypeGroup) {
- visit_type_group(self, i);
+ visit_type_group(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_impl_trait(&mut self, i: &'ast TypeImplTrait) {
- visit_type_impl_trait(self, i);
+ visit_type_impl_trait(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_infer(&mut self, i: &'ast TypeInfer) {
- visit_type_infer(self, i);
+ visit_type_infer(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_macro(&mut self, i: &'ast TypeMacro) {
- visit_type_macro(self, i);
+ visit_type_macro(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_never(&mut self, i: &'ast TypeNever) {
- visit_type_never(self, i);
+ visit_type_never(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_param(&mut self, i: &'ast TypeParam) {
- visit_type_param(self, i);
+ visit_type_param(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_param_bound(&mut self, i: &'ast TypeParamBound) {
- visit_type_param_bound(self, i);
+ visit_type_param_bound(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_paren(&mut self, i: &'ast TypeParen) {
- visit_type_paren(self, i);
+ visit_type_paren(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_path(&mut self, i: &'ast TypePath) {
- visit_type_path(self, i);
+ visit_type_path(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_ptr(&mut self, i: &'ast TypePtr) {
- visit_type_ptr(self, i);
+ visit_type_ptr(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_reference(&mut self, i: &'ast TypeReference) {
- visit_type_reference(self, i);
+ visit_type_reference(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_slice(&mut self, i: &'ast TypeSlice) {
- visit_type_slice(self, i);
+ visit_type_slice(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_trait_object(&mut self, i: &'ast TypeTraitObject) {
- visit_type_trait_object(self, i);
+ visit_type_trait_object(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_tuple(&mut self, i: &'ast TypeTuple) {
- visit_type_tuple(self, i);
+ visit_type_tuple(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_un_op(&mut self, i: &'ast UnOp) {
- visit_un_op(self, i);
+ visit_un_op(self, i)
}
#[cfg(feature = "full")]
fn visit_use_glob(&mut self, i: &'ast UseGlob) {
- visit_use_glob(self, i);
+ visit_use_glob(self, i)
}
#[cfg(feature = "full")]
fn visit_use_group(&mut self, i: &'ast UseGroup) {
- visit_use_group(self, i);
+ visit_use_group(self, i)
}
#[cfg(feature = "full")]
fn visit_use_name(&mut self, i: &'ast UseName) {
- visit_use_name(self, i);
+ visit_use_name(self, i)
}
#[cfg(feature = "full")]
fn visit_use_path(&mut self, i: &'ast UsePath) {
- visit_use_path(self, i);
+ visit_use_path(self, i)
}
#[cfg(feature = "full")]
fn visit_use_rename(&mut self, i: &'ast UseRename) {
- visit_use_rename(self, i);
+ visit_use_rename(self, i)
}
#[cfg(feature = "full")]
fn visit_use_tree(&mut self, i: &'ast UseTree) {
- visit_use_tree(self, i);
+ visit_use_tree(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_variadic(&mut self, i: &'ast Variadic) {
- visit_variadic(self, i);
+ visit_variadic(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_variant(&mut self, i: &'ast Variant) {
- visit_variant(self, i);
+ visit_variant(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_vis_crate(&mut self, i: &'ast VisCrate) {
- visit_vis_crate(self, i);
+ visit_vis_crate(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_vis_public(&mut self, i: &'ast VisPublic) {
- visit_vis_public(self, i);
+ visit_vis_public(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_vis_restricted(&mut self, i: &'ast VisRestricted) {
- visit_vis_restricted(self, i);
+ visit_vis_restricted(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_visibility(&mut self, i: &'ast Visibility) {
- visit_visibility(self, i);
+ visit_visibility(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_where_clause(&mut self, i: &'ast WhereClause) {
- visit_where_clause(self, i);
+ visit_where_clause(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_where_predicate(&mut self, i: &'ast WherePredicate) {
- visit_where_predicate(self, i);
+ visit_where_predicate(self, i)
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -782,20 +776,19 @@ where
{
tokens_helper(v, &node.extern_token.span);
if let Some(it) = &node.name {
- v.visit_lit_str(it);
- }
+ v.visit_lit_str(it)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_angle_bracketed_generic_arguments<'ast, V>(
v: &mut V,
node: &'ast AngleBracketedGenericArguments,
-)
-where
+) where
V: Visit<'ast> + ?Sized,
{
if let Some(it) = &node.colon2_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
tokens_helper(v, &node.lt_token.spans);
for el in Punctuated::pairs(&node.args) {
let (it, p) = el.into_tuple();
@@ -812,18 +805,18 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_pat(&node.pat);
if let Some(it) = &node.guard {
tokens_helper(v, &(it).0.span);
v.visit_expr(&*(it).1);
- }
+ };
tokens_helper(v, &node.fat_arrow_token.spans);
v.visit_expr(&*node.body);
if let Some(it) = &node.comma {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_attr_style<'ast, V>(v: &mut V, node: &'ast AttrStyle)
@@ -854,12 +847,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.name {
v.visit_ident(&(it).0);
tokens_helper(v, &(it).1.spans);
- }
+ };
v.visit_type(&node.ty);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -970,7 +963,7 @@ where
{
tokens_helper(v, &node.brace_token.span);
for it in &node.stmts {
- v.visit_stmt(it);
+ v.visit_stmt(it)
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -995,18 +988,18 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.const_token.span);
v.visit_ident(&node.ident);
tokens_helper(v, &node.colon_token.spans);
v.visit_type(&node.ty);
if let Some(it) = &node.eq_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
if let Some(it) = &node.default {
- v.visit_expr(it);
- }
+ v.visit_expr(it)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_constraint<'ast, V>(v: &mut V, node: &'ast Constraint)
@@ -1063,8 +1056,8 @@ where
tokens_helper(v, &node.struct_token.span);
v.visit_fields(&node.fields);
if let Some(it) = &node.semi_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
}
#[cfg(feature = "derive")]
pub fn visit_data_union<'ast, V>(v: &mut V, node: &'ast DataUnion)
@@ -1080,7 +1073,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
v.visit_ident(&node.ident);
@@ -1222,7 +1215,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.bracket_token.span);
for el in Punctuated::pairs(&node.elems) {
@@ -1239,7 +1232,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.left);
tokens_helper(v, &node.eq_token.spans);
@@ -1251,7 +1244,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.left);
v.visit_bin_op(&node.op);
@@ -1263,12 +1256,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.async_token.span);
if let Some(it) = &node.capture {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
v.visit_block(&node.block);
}
#[cfg(feature = "full")]
@@ -1277,7 +1270,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.base);
tokens_helper(v, &node.dot_token.spans);
@@ -1289,7 +1282,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.left);
v.visit_bin_op(&node.op);
@@ -1301,11 +1294,11 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.label {
- v.visit_label(it);
- }
+ v.visit_label(it)
+ };
v.visit_block(&node.block);
}
#[cfg(feature = "full")]
@@ -1314,7 +1307,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.box_token.span);
v.visit_expr(&*node.expr);
@@ -1325,15 +1318,15 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.break_token.span);
if let Some(it) = &node.label {
- v.visit_lifetime(it);
- }
+ v.visit_lifetime(it)
+ };
if let Some(it) = &node.expr {
- v.visit_expr(&**it);
- }
+ v.visit_expr(&**it)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_expr_call<'ast, V>(v: &mut V, node: &'ast ExprCall)
@@ -1341,7 +1334,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.func);
tokens_helper(v, &node.paren_token.span);
@@ -1359,7 +1352,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.expr);
tokens_helper(v, &node.as_token.span);
@@ -1371,17 +1364,17 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
- }
- if let Some(it) = &node.movability {
- tokens_helper(v, &it.span);
+ v.visit_attribute(it)
}
if let Some(it) = &node.asyncness {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
+ if let Some(it) = &node.movability {
+ tokens_helper(v, &it.span)
+ };
if let Some(it) = &node.capture {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
tokens_helper(v, &node.or1_token.spans);
for el in Punctuated::pairs(&node.inputs) {
let (it, p) = el.into_tuple();
@@ -1400,12 +1393,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.continue_token.span);
if let Some(it) = &node.label {
- v.visit_lifetime(it);
- }
+ v.visit_lifetime(it)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_expr_field<'ast, V>(v: &mut V, node: &'ast ExprField)
@@ -1413,7 +1406,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.base);
tokens_helper(v, &node.dot_token.spans);
@@ -1425,11 +1418,11 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.label {
- v.visit_label(it);
- }
+ v.visit_label(it)
+ };
tokens_helper(v, &node.for_token.span);
v.visit_pat(&node.pat);
tokens_helper(v, &node.in_token.span);
@@ -1442,7 +1435,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.group_token.span);
v.visit_expr(&*node.expr);
@@ -1453,7 +1446,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.if_token.span);
v.visit_expr(&*node.cond);
@@ -1461,7 +1454,7 @@ where
if let Some(it) = &node.else_branch {
tokens_helper(v, &(it).0.span);
v.visit_expr(&*(it).1);
- }
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_expr_index<'ast, V>(v: &mut V, node: &'ast ExprIndex)
@@ -1469,7 +1462,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.expr);
tokens_helper(v, &node.bracket_token.span);
@@ -1481,7 +1474,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.let_token.span);
v.visit_pat(&node.pat);
@@ -1494,7 +1487,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_lit(&node.lit);
}
@@ -1504,11 +1497,11 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.label {
- v.visit_label(it);
- }
+ v.visit_label(it)
+ };
tokens_helper(v, &node.loop_token.span);
v.visit_block(&node.body);
}
@@ -1518,7 +1511,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_macro(&node.mac);
}
@@ -1528,13 +1521,13 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.match_token.span);
v.visit_expr(&*node.expr);
tokens_helper(v, &node.brace_token.span);
for it in &node.arms {
- v.visit_arm(it);
+ v.visit_arm(it)
}
}
#[cfg(feature = "full")]
@@ -1543,14 +1536,14 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.receiver);
tokens_helper(v, &node.dot_token.spans);
v.visit_ident(&node.method);
if let Some(it) = &node.turbofish {
- v.visit_method_turbofish(it);
- }
+ v.visit_method_turbofish(it)
+ };
tokens_helper(v, &node.paren_token.span);
for el in Punctuated::pairs(&node.args) {
let (it, p) = el.into_tuple();
@@ -1566,7 +1559,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.paren_token.span);
v.visit_expr(&*node.expr);
@@ -1577,11 +1570,11 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.qself {
- v.visit_qself(it);
- }
+ v.visit_qself(it)
+ };
v.visit_path(&node.path);
}
#[cfg(feature = "full")]
@@ -1590,15 +1583,15 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.from {
- v.visit_expr(&**it);
- }
+ v.visit_expr(&**it)
+ };
v.visit_range_limits(&node.limits);
if let Some(it) = &node.to {
- v.visit_expr(&**it);
- }
+ v.visit_expr(&**it)
+ };
}
#[cfg(feature = "full")]
pub fn visit_expr_reference<'ast, V>(v: &mut V, node: &'ast ExprReference)
@@ -1606,12 +1599,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.and_token.spans);
if let Some(it) = &node.mutability {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
v.visit_expr(&*node.expr);
}
#[cfg(feature = "full")]
@@ -1620,7 +1613,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.bracket_token.span);
v.visit_expr(&*node.expr);
@@ -1633,12 +1626,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.return_token.span);
if let Some(it) = &node.expr {
- v.visit_expr(&**it);
- }
+ v.visit_expr(&**it)
+ };
}
#[cfg(feature = "full")]
pub fn visit_expr_struct<'ast, V>(v: &mut V, node: &'ast ExprStruct)
@@ -1646,7 +1639,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_path(&node.path);
tokens_helper(v, &node.brace_token.span);
@@ -1658,11 +1651,11 @@ where
}
}
if let Some(it) = &node.dot2_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
if let Some(it) = &node.rest {
- v.visit_expr(&**it);
- }
+ v.visit_expr(&**it)
+ };
}
#[cfg(feature = "full")]
pub fn visit_expr_try<'ast, V>(v: &mut V, node: &'ast ExprTry)
@@ -1670,7 +1663,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.expr);
tokens_helper(v, &node.question_token.spans);
@@ -1681,7 +1674,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.try_token.span);
v.visit_block(&node.block);
@@ -1692,7 +1685,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.paren_token.span);
for el in Punctuated::pairs(&node.elems) {
@@ -1709,7 +1702,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.expr);
tokens_helper(v, &node.colon_token.spans);
@@ -1721,7 +1714,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_un_op(&node.op);
v.visit_expr(&*node.expr);
@@ -1732,7 +1725,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.unsafe_token.span);
v.visit_block(&node.block);
@@ -1743,11 +1736,11 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.label {
- v.visit_label(it);
- }
+ v.visit_label(it)
+ };
tokens_helper(v, &node.while_token.span);
v.visit_expr(&*node.cond);
v.visit_block(&node.body);
@@ -1758,12 +1751,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.yield_token.span);
if let Some(it) = &node.expr {
- v.visit_expr(&**it);
- }
+ v.visit_expr(&**it)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_field<'ast, V>(v: &mut V, node: &'ast Field)
@@ -1771,15 +1764,15 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
if let Some(it) = &node.ident {
- v.visit_ident(it);
- }
+ v.visit_ident(it)
+ };
if let Some(it) = &node.colon_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
v.visit_type(&node.ty);
}
#[cfg(feature = "full")]
@@ -1788,12 +1781,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_member(&node.member);
if let Some(it) = &node.colon_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
v.visit_pat(&*node.pat);
}
#[cfg(feature = "full")]
@@ -1802,12 +1795,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_member(&node.member);
if let Some(it) = &node.colon_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
v.visit_expr(&node.expr);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -1860,10 +1853,10 @@ where
{
skip!(node.shebang);
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
for it in &node.items {
- v.visit_item(it);
+ v.visit_item(it)
}
}
#[cfg(feature = "full")]
@@ -1910,7 +1903,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
v.visit_signature(&node.sig);
@@ -1922,12 +1915,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_macro(&node.mac);
if let Some(it) = &node.semi_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_foreign_item_static<'ast, V>(v: &mut V, node: &'ast ForeignItemStatic)
@@ -1935,13 +1928,13 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.static_token.span);
if let Some(it) = &node.mutability {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
v.visit_ident(&node.ident);
tokens_helper(v, &node.colon_token.spans);
v.visit_type(&*node.ty);
@@ -1953,7 +1946,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.type_token.span);
@@ -1984,10 +1977,7 @@ where
}
}
#[cfg(feature = "full")]
-pub fn visit_generic_method_argument<'ast, V>(
- v: &mut V,
- node: &'ast GenericMethodArgument,
-)
+pub fn visit_generic_method_argument<'ast, V>(v: &mut V, node: &'ast GenericMethodArgument)
where
V: Visit<'ast> + ?Sized,
{
@@ -2023,8 +2013,8 @@ where
V: Visit<'ast> + ?Sized,
{
if let Some(it) = &node.lt_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
for el in Punctuated::pairs(&node.params) {
let (it, p) = el.into_tuple();
v.visit_generic_param(it);
@@ -2033,11 +2023,11 @@ where
}
}
if let Some(it) = &node.gt_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
if let Some(it) = &node.where_clause {
- v.visit_where_clause(it);
- }
+ v.visit_where_clause(it)
+ };
}
pub fn visit_ident<'ast, V>(v: &mut V, node: &'ast Ident)
where
@@ -2075,12 +2065,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
if let Some(it) = &node.defaultness {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
tokens_helper(v, &node.const_token.span);
v.visit_ident(&node.ident);
tokens_helper(v, &node.colon_token.spans);
@@ -2095,12 +2085,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_macro(&node.mac);
if let Some(it) = &node.semi_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_impl_item_method<'ast, V>(v: &mut V, node: &'ast ImplItemMethod)
@@ -2108,12 +2098,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
if let Some(it) = &node.defaultness {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
v.visit_signature(&node.sig);
v.visit_block(&node.block);
}
@@ -2123,12 +2113,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
if let Some(it) = &node.defaultness {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
tokens_helper(v, &node.type_token.span);
v.visit_ident(&node.ident);
v.visit_generics(&node.generics);
@@ -2210,7 +2200,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.const_token.span);
@@ -2227,7 +2217,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.enum_token.span);
@@ -2248,7 +2238,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.extern_token.span);
@@ -2257,7 +2247,7 @@ where
if let Some(it) = &node.rename {
tokens_helper(v, &(it).0.span);
v.visit_ident(&(it).1);
- }
+ };
tokens_helper(v, &node.semi_token.spans);
}
#[cfg(feature = "full")]
@@ -2266,7 +2256,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
v.visit_signature(&node.sig);
@@ -2278,12 +2268,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_abi(&node.abi);
tokens_helper(v, &node.brace_token.span);
for it in &node.items {
- v.visit_foreign_item(it);
+ v.visit_foreign_item(it)
}
}
#[cfg(feature = "full")]
@@ -2292,27 +2282,27 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.defaultness {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
if let Some(it) = &node.unsafety {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
tokens_helper(v, &node.impl_token.span);
v.visit_generics(&node.generics);
if let Some(it) = &node.trait_ {
if let Some(it) = &(it).0 {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
v.visit_path(&(it).1);
tokens_helper(v, &(it).2.span);
- }
+ };
v.visit_type(&*node.self_ty);
tokens_helper(v, &node.brace_token.span);
for it in &node.items {
- v.visit_impl_item(it);
+ v.visit_impl_item(it)
}
}
#[cfg(feature = "full")]
@@ -2321,15 +2311,15 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.ident {
- v.visit_ident(it);
- }
+ v.visit_ident(it)
+ };
v.visit_macro(&node.mac);
if let Some(it) = &node.semi_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_item_macro2<'ast, V>(v: &mut V, node: &'ast ItemMacro2)
@@ -2337,7 +2327,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.macro_token.span);
@@ -2350,7 +2340,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.mod_token.span);
@@ -2358,12 +2348,12 @@ where
if let Some(it) = &node.content {
tokens_helper(v, &(it).0.span);
for it in &(it).1 {
- v.visit_item(it);
+ v.visit_item(it)
}
- }
+ };
if let Some(it) = &node.semi {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_item_static<'ast, V>(v: &mut V, node: &'ast ItemStatic)
@@ -2371,13 +2361,13 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.static_token.span);
if let Some(it) = &node.mutability {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
v.visit_ident(&node.ident);
tokens_helper(v, &node.colon_token.spans);
v.visit_type(&*node.ty);
@@ -2391,7 +2381,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.struct_token.span);
@@ -2399,8 +2389,8 @@ where
v.visit_generics(&node.generics);
v.visit_fields(&node.fields);
if let Some(it) = &node.semi_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_item_trait<'ast, V>(v: &mut V, node: &'ast ItemTrait)
@@ -2408,21 +2398,21 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
if let Some(it) = &node.unsafety {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
if let Some(it) = &node.auto_token {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
tokens_helper(v, &node.trait_token.span);
v.visit_ident(&node.ident);
v.visit_generics(&node.generics);
if let Some(it) = &node.colon_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
for el in Punctuated::pairs(&node.supertraits) {
let (it, p) = el.into_tuple();
v.visit_type_param_bound(it);
@@ -2432,7 +2422,7 @@ where
}
tokens_helper(v, &node.brace_token.span);
for it in &node.items {
- v.visit_trait_item(it);
+ v.visit_trait_item(it)
}
}
#[cfg(feature = "full")]
@@ -2441,7 +2431,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.trait_token.span);
@@ -2463,7 +2453,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.type_token.span);
@@ -2479,7 +2469,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.union_token.span);
@@ -2493,13 +2483,13 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_visibility(&node.vis);
tokens_helper(v, &node.use_token.span);
if let Some(it) = &node.leading_colon {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
v.visit_use_tree(&node.tree);
tokens_helper(v, &node.semi_token.spans);
}
@@ -2524,12 +2514,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_lifetime(&node.lifetime);
if let Some(it) = &node.colon_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
for el in Punctuated::pairs(&node.bounds) {
let (it, p) = el.into_tuple();
v.visit_lifetime(it);
@@ -2579,41 +2569,47 @@ where
pub fn visit_lit_byte<'ast, V>(v: &mut V, node: &'ast LitByte)
where
V: Visit<'ast> + ?Sized,
-{}
+{
+}
pub fn visit_lit_byte_str<'ast, V>(v: &mut V, node: &'ast LitByteStr)
where
V: Visit<'ast> + ?Sized,
-{}
+{
+}
pub fn visit_lit_char<'ast, V>(v: &mut V, node: &'ast LitChar)
where
V: Visit<'ast> + ?Sized,
-{}
+{
+}
pub fn visit_lit_float<'ast, V>(v: &mut V, node: &'ast LitFloat)
where
V: Visit<'ast> + ?Sized,
-{}
+{
+}
pub fn visit_lit_int<'ast, V>(v: &mut V, node: &'ast LitInt)
where
V: Visit<'ast> + ?Sized,
-{}
+{
+}
pub fn visit_lit_str<'ast, V>(v: &mut V, node: &'ast LitStr)
where
V: Visit<'ast> + ?Sized,
-{}
+{
+}
#[cfg(feature = "full")]
pub fn visit_local<'ast, V>(v: &mut V, node: &'ast Local)
where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.let_token.span);
v.visit_pat(&node.pat);
if let Some(it) = &node.init {
tokens_helper(v, &(it).0.spans);
v.visit_expr(&*(it).1);
- }
+ };
tokens_helper(v, &node.semi_token.spans);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -2732,8 +2728,7 @@ where
pub fn visit_parenthesized_generic_arguments<'ast, V>(
v: &mut V,
node: &'ast ParenthesizedGenericArguments,
-)
-where
+) where
V: Visit<'ast> + ?Sized,
{
tokens_helper(v, &node.paren_token.span);
@@ -2809,7 +2804,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.box_token.span);
v.visit_pat(&*node.pat);
@@ -2820,19 +2815,19 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.by_ref {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
if let Some(it) = &node.mutability {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
v.visit_ident(&node.ident);
if let Some(it) = &node.subpat {
tokens_helper(v, &(it).0.spans);
v.visit_pat(&*(it).1);
- }
+ };
}
#[cfg(feature = "full")]
pub fn visit_pat_lit<'ast, V>(v: &mut V, node: &'ast PatLit)
@@ -2840,7 +2835,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.expr);
}
@@ -2850,7 +2845,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_macro(&node.mac);
}
@@ -2860,11 +2855,11 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.leading_vert {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
for el in Punctuated::pairs(&node.cases) {
let (it, p) = el.into_tuple();
v.visit_pat(it);
@@ -2879,11 +2874,11 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.qself {
- v.visit_qself(it);
- }
+ v.visit_qself(it)
+ };
v.visit_path(&node.path);
}
#[cfg(feature = "full")]
@@ -2892,7 +2887,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_expr(&*node.lo);
v.visit_range_limits(&node.limits);
@@ -2904,12 +2899,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.and_token.spans);
if let Some(it) = &node.mutability {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
v.visit_pat(&*node.pat);
}
#[cfg(feature = "full")]
@@ -2918,7 +2913,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.dot2_token.spans);
}
@@ -2928,7 +2923,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.bracket_token.span);
for el in Punctuated::pairs(&node.elems) {
@@ -2945,7 +2940,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_path(&node.path);
tokens_helper(v, &node.brace_token.span);
@@ -2957,8 +2952,8 @@ where
}
}
if let Some(it) = &node.dot2_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_pat_tuple<'ast, V>(v: &mut V, node: &'ast PatTuple)
@@ -2966,7 +2961,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.paren_token.span);
for el in Punctuated::pairs(&node.elems) {
@@ -2983,7 +2978,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_path(&node.path);
v.visit_pat_tuple(&node.pat);
@@ -2994,7 +2989,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_pat(&*node.pat);
tokens_helper(v, &node.colon_token.spans);
@@ -3006,7 +3001,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.underscore_token.spans);
}
@@ -3016,8 +3011,8 @@ where
V: Visit<'ast> + ?Sized,
{
if let Some(it) = &node.leading_colon {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
for el in Punctuated::pairs(&node.segments) {
let (it, p) = el.into_tuple();
v.visit_path_segment(it);
@@ -3079,8 +3074,8 @@ where
V: Visit<'ast> + ?Sized,
{
if let Some(it) = &node.lifetimes {
- v.visit_bound_lifetimes(it);
- }
+ v.visit_bound_lifetimes(it)
+ };
v.visit_type(&node.bounded_ty);
tokens_helper(v, &node.colon_token.spans);
for el in Punctuated::pairs(&node.bounds) {
@@ -3100,8 +3095,8 @@ where
v.visit_type(&*node.ty);
skip!(node.position);
if let Some(it) = &node.as_token {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
tokens_helper(v, &node.gt_token.spans);
}
#[cfg(feature = "full")]
@@ -3124,17 +3119,17 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
if let Some(it) = &node.reference {
tokens_helper(v, &(it).0.spans);
if let Some(it) = &(it).1 {
- v.visit_lifetime(it);
- }
- }
+ v.visit_lifetime(it)
+ };
+ };
if let Some(it) = &node.mutability {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
tokens_helper(v, &node.self_token.span);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3156,17 +3151,17 @@ where
V: Visit<'ast> + ?Sized,
{
if let Some(it) = &node.constness {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
if let Some(it) = &node.asyncness {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
if let Some(it) = &node.unsafety {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
if let Some(it) = &node.abi {
- v.visit_abi(it);
- }
+ v.visit_abi(it)
+ };
tokens_helper(v, &node.fn_token.span);
v.visit_ident(&node.ident);
v.visit_generics(&node.generics);
@@ -3179,14 +3174,15 @@ where
}
}
if let Some(it) = &node.variadic {
- v.visit_variadic(it);
- }
+ v.visit_variadic(it)
+ };
v.visit_return_type(&node.output);
}
pub fn visit_span<'ast, V>(v: &mut V, node: &Span)
where
V: Visit<'ast> + ?Sized,
-{}
+{
+}
#[cfg(feature = "full")]
pub fn visit_stmt<'ast, V>(v: &mut V, node: &'ast Stmt)
where
@@ -3214,12 +3210,12 @@ where
V: Visit<'ast> + ?Sized,
{
if let Some(it) = &node.paren_token {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
v.visit_trait_bound_modifier(&node.modifier);
if let Some(it) = &node.lifetimes {
- v.visit_bound_lifetimes(it);
- }
+ v.visit_bound_lifetimes(it)
+ };
v.visit_path(&node.path);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3264,7 +3260,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.const_token.span);
v.visit_ident(&node.ident);
@@ -3273,7 +3269,7 @@ where
if let Some(it) = &node.default {
tokens_helper(v, &(it).0.spans);
v.visit_expr(&(it).1);
- }
+ };
tokens_helper(v, &node.semi_token.spans);
}
#[cfg(feature = "full")]
@@ -3282,12 +3278,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_macro(&node.mac);
if let Some(it) = &node.semi_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_trait_item_method<'ast, V>(v: &mut V, node: &'ast TraitItemMethod)
@@ -3295,15 +3291,15 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_signature(&node.sig);
if let Some(it) = &node.default {
- v.visit_block(it);
- }
+ v.visit_block(it)
+ };
if let Some(it) = &node.semi_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_trait_item_type<'ast, V>(v: &mut V, node: &'ast TraitItemType)
@@ -3311,14 +3307,14 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.type_token.span);
v.visit_ident(&node.ident);
v.visit_generics(&node.generics);
if let Some(it) = &node.colon_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
for el in Punctuated::pairs(&node.bounds) {
let (it, p) = el.into_tuple();
v.visit_type_param_bound(it);
@@ -3329,7 +3325,7 @@ where
if let Some(it) = &node.default {
tokens_helper(v, &(it).0.spans);
v.visit_type(&(it).1);
- }
+ };
tokens_helper(v, &node.semi_token.spans);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3402,14 +3398,14 @@ where
V: Visit<'ast> + ?Sized,
{
if let Some(it) = &node.lifetimes {
- v.visit_bound_lifetimes(it);
- }
+ v.visit_bound_lifetimes(it)
+ };
if let Some(it) = &node.unsafety {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
if let Some(it) = &node.abi {
- v.visit_abi(it);
- }
+ v.visit_abi(it)
+ };
tokens_helper(v, &node.fn_token.span);
tokens_helper(v, &node.paren_token.span);
for el in Punctuated::pairs(&node.inputs) {
@@ -3420,8 +3416,8 @@ where
}
}
if let Some(it) = &node.variadic {
- v.visit_variadic(it);
- }
+ v.visit_variadic(it)
+ };
v.visit_return_type(&node.output);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3473,12 +3469,12 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_ident(&node.ident);
if let Some(it) = &node.colon_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
for el in Punctuated::pairs(&node.bounds) {
let (it, p) = el.into_tuple();
v.visit_type_param_bound(it);
@@ -3487,11 +3483,11 @@ where
}
}
if let Some(it) = &node.eq_token {
- tokens_helper(v, &it.spans);
- }
+ tokens_helper(v, &it.spans)
+ };
if let Some(it) = &node.default {
- v.visit_type(it);
- }
+ v.visit_type(it)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_type_param_bound<'ast, V>(v: &mut V, node: &'ast TypeParamBound)
@@ -3521,8 +3517,8 @@ where
V: Visit<'ast> + ?Sized,
{
if let Some(it) = &node.qself {
- v.visit_qself(it);
- }
+ v.visit_qself(it)
+ };
v.visit_path(&node.path);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3532,11 +3528,11 @@ where
{
tokens_helper(v, &node.star_token.spans);
if let Some(it) = &node.const_token {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
if let Some(it) = &node.mutability {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
v.visit_type(&*node.elem);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3546,11 +3542,11 @@ where
{
tokens_helper(v, &node.and_token.spans);
if let Some(it) = &node.lifetime {
- v.visit_lifetime(it);
- }
+ v.visit_lifetime(it)
+ };
if let Some(it) = &node.mutability {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
v.visit_type(&*node.elem);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3567,8 +3563,8 @@ where
V: Visit<'ast> + ?Sized,
{
if let Some(it) = &node.dyn_token {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
for el in Punctuated::pairs(&node.bounds) {
let (it, p) = el.into_tuple();
v.visit_type_param_bound(it);
@@ -3683,7 +3679,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
tokens_helper(v, &node.dots.spans);
}
@@ -3693,14 +3689,14 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it);
+ v.visit_attribute(it)
}
v.visit_ident(&node.ident);
v.visit_fields(&node.fields);
if let Some(it) = &node.discriminant {
tokens_helper(v, &(it).0.spans);
v.visit_expr(&(it).1);
- }
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_vis_crate<'ast, V>(v: &mut V, node: &'ast VisCrate)
@@ -3724,8 +3720,8 @@ where
tokens_helper(v, &node.pub_token.span);
tokens_helper(v, &node.paren_token.span);
if let Some(it) = &node.in_token {
- tokens_helper(v, &it.span);
- }
+ tokens_helper(v, &it.span)
+ };
v.visit_path(&*node.path);
}
#[cfg(any(feature = "derive", feature = "full"))]
diff --git a/src/gen/visit_mut.rs b/src/gen/visit_mut.rs
index 51e10b60..5ce11f0b 100644
--- a/src/gen/visit_mut.rs
+++ b/src/gen/visit_mut.rs
@@ -17,7 +17,7 @@ macro_rules! full {
#[cfg(all(feature = "derive", not(feature = "full")))]
macro_rules! full {
($e:expr) => {
- unreachable ! ()
+ unreachable!()
};
}
macro_rules! skip {
@@ -34,746 +34,743 @@ macro_rules! skip {
pub trait VisitMut {
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_abi_mut(&mut self, i: &mut Abi) {
- visit_abi_mut(self, i);
+ visit_abi_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_angle_bracketed_generic_arguments_mut(
&mut self,
i: &mut AngleBracketedGenericArguments,
) {
- visit_angle_bracketed_generic_arguments_mut(self, i);
+ visit_angle_bracketed_generic_arguments_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_arm_mut(&mut self, i: &mut Arm) {
- visit_arm_mut(self, i);
+ visit_arm_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_attr_style_mut(&mut self, i: &mut AttrStyle) {
- visit_attr_style_mut(self, i);
+ visit_attr_style_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_attribute_mut(&mut self, i: &mut Attribute) {
- visit_attribute_mut(self, i);
+ visit_attribute_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_bare_fn_arg_mut(&mut self, i: &mut BareFnArg) {
- visit_bare_fn_arg_mut(self, i);
+ visit_bare_fn_arg_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_bin_op_mut(&mut self, i: &mut BinOp) {
- visit_bin_op_mut(self, i);
+ visit_bin_op_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_binding_mut(&mut self, i: &mut Binding) {
- visit_binding_mut(self, i);
+ visit_binding_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_block_mut(&mut self, i: &mut Block) {
- visit_block_mut(self, i);
+ visit_block_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_bound_lifetimes_mut(&mut self, i: &mut BoundLifetimes) {
- visit_bound_lifetimes_mut(self, i);
+ visit_bound_lifetimes_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_const_param_mut(&mut self, i: &mut ConstParam) {
- visit_const_param_mut(self, i);
+ visit_const_param_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_constraint_mut(&mut self, i: &mut Constraint) {
- visit_constraint_mut(self, i);
+ visit_constraint_mut(self, i)
}
#[cfg(feature = "derive")]
fn visit_data_mut(&mut self, i: &mut Data) {
- visit_data_mut(self, i);
+ visit_data_mut(self, i)
}
#[cfg(feature = "derive")]
fn visit_data_enum_mut(&mut self, i: &mut DataEnum) {
- visit_data_enum_mut(self, i);
+ visit_data_enum_mut(self, i)
}
#[cfg(feature = "derive")]
fn visit_data_struct_mut(&mut self, i: &mut DataStruct) {
- visit_data_struct_mut(self, i);
+ visit_data_struct_mut(self, i)
}
#[cfg(feature = "derive")]
fn visit_data_union_mut(&mut self, i: &mut DataUnion) {
- visit_data_union_mut(self, i);
+ visit_data_union_mut(self, i)
}
#[cfg(feature = "derive")]
fn visit_derive_input_mut(&mut self, i: &mut DeriveInput) {
- visit_derive_input_mut(self, i);
+ visit_derive_input_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_mut(&mut self, i: &mut Expr) {
- visit_expr_mut(self, i);
+ visit_expr_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_array_mut(&mut self, i: &mut ExprArray) {
- visit_expr_array_mut(self, i);
+ visit_expr_array_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_assign_mut(&mut self, i: &mut ExprAssign) {
- visit_expr_assign_mut(self, i);
+ visit_expr_assign_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_assign_op_mut(&mut self, i: &mut ExprAssignOp) {
- visit_expr_assign_op_mut(self, i);
+ visit_expr_assign_op_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_async_mut(&mut self, i: &mut ExprAsync) {
- visit_expr_async_mut(self, i);
+ visit_expr_async_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_await_mut(&mut self, i: &mut ExprAwait) {
- visit_expr_await_mut(self, i);
+ visit_expr_await_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_binary_mut(&mut self, i: &mut ExprBinary) {
- visit_expr_binary_mut(self, i);
+ visit_expr_binary_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_block_mut(&mut self, i: &mut ExprBlock) {
- visit_expr_block_mut(self, i);
+ visit_expr_block_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_box_mut(&mut self, i: &mut ExprBox) {
- visit_expr_box_mut(self, i);
+ visit_expr_box_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_break_mut(&mut self, i: &mut ExprBreak) {
- visit_expr_break_mut(self, i);
+ visit_expr_break_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_call_mut(&mut self, i: &mut ExprCall) {
- visit_expr_call_mut(self, i);
+ visit_expr_call_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_cast_mut(&mut self, i: &mut ExprCast) {
- visit_expr_cast_mut(self, i);
+ visit_expr_cast_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_closure_mut(&mut self, i: &mut ExprClosure) {
- visit_expr_closure_mut(self, i);
+ visit_expr_closure_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_continue_mut(&mut self, i: &mut ExprContinue) {
- visit_expr_continue_mut(self, i);
+ visit_expr_continue_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_field_mut(&mut self, i: &mut ExprField) {
- visit_expr_field_mut(self, i);
+ visit_expr_field_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_for_loop_mut(&mut self, i: &mut ExprForLoop) {
- visit_expr_for_loop_mut(self, i);
+ visit_expr_for_loop_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_group_mut(&mut self, i: &mut ExprGroup) {
- visit_expr_group_mut(self, i);
+ visit_expr_group_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_if_mut(&mut self, i: &mut ExprIf) {
- visit_expr_if_mut(self, i);
+ visit_expr_if_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_index_mut(&mut self, i: &mut ExprIndex) {
- visit_expr_index_mut(self, i);
+ visit_expr_index_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_let_mut(&mut self, i: &mut ExprLet) {
- visit_expr_let_mut(self, i);
+ visit_expr_let_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_lit_mut(&mut self, i: &mut ExprLit) {
- visit_expr_lit_mut(self, i);
+ visit_expr_lit_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_loop_mut(&mut self, i: &mut ExprLoop) {
- visit_expr_loop_mut(self, i);
+ visit_expr_loop_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_macro_mut(&mut self, i: &mut ExprMacro) {
- visit_expr_macro_mut(self, i);
+ visit_expr_macro_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_match_mut(&mut self, i: &mut ExprMatch) {
- visit_expr_match_mut(self, i);
+ visit_expr_match_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_method_call_mut(&mut self, i: &mut ExprMethodCall) {
- visit_expr_method_call_mut(self, i);
+ visit_expr_method_call_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_paren_mut(&mut self, i: &mut ExprParen) {
- visit_expr_paren_mut(self, i);
+ visit_expr_paren_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_path_mut(&mut self, i: &mut ExprPath) {
- visit_expr_path_mut(self, i);
+ visit_expr_path_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_range_mut(&mut self, i: &mut ExprRange) {
- visit_expr_range_mut(self, i);
+ visit_expr_range_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_reference_mut(&mut self, i: &mut ExprReference) {
- visit_expr_reference_mut(self, i);
+ visit_expr_reference_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_repeat_mut(&mut self, i: &mut ExprRepeat) {
- visit_expr_repeat_mut(self, i);
+ visit_expr_repeat_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_return_mut(&mut self, i: &mut ExprReturn) {
- visit_expr_return_mut(self, i);
+ visit_expr_return_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_struct_mut(&mut self, i: &mut ExprStruct) {
- visit_expr_struct_mut(self, i);
+ visit_expr_struct_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_try_mut(&mut self, i: &mut ExprTry) {
- visit_expr_try_mut(self, i);
+ visit_expr_try_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_try_block_mut(&mut self, i: &mut ExprTryBlock) {
- visit_expr_try_block_mut(self, i);
+ visit_expr_try_block_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_tuple_mut(&mut self, i: &mut ExprTuple) {
- visit_expr_tuple_mut(self, i);
+ visit_expr_tuple_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_type_mut(&mut self, i: &mut ExprType) {
- visit_expr_type_mut(self, i);
+ visit_expr_type_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_expr_unary_mut(&mut self, i: &mut ExprUnary) {
- visit_expr_unary_mut(self, i);
+ visit_expr_unary_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_unsafe_mut(&mut self, i: &mut ExprUnsafe) {
- visit_expr_unsafe_mut(self, i);
+ visit_expr_unsafe_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_while_mut(&mut self, i: &mut ExprWhile) {
- visit_expr_while_mut(self, i);
+ visit_expr_while_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_expr_yield_mut(&mut self, i: &mut ExprYield) {
- visit_expr_yield_mut(self, i);
+ visit_expr_yield_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_field_mut(&mut self, i: &mut Field) {
- visit_field_mut(self, i);
+ visit_field_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_field_pat_mut(&mut self, i: &mut FieldPat) {
- visit_field_pat_mut(self, i);
+ visit_field_pat_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_field_value_mut(&mut self, i: &mut FieldValue) {
- visit_field_value_mut(self, i);
+ visit_field_value_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_fields_mut(&mut self, i: &mut Fields) {
- visit_fields_mut(self, i);
+ visit_fields_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_fields_named_mut(&mut self, i: &mut FieldsNamed) {
- visit_fields_named_mut(self, i);
+ visit_fields_named_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_fields_unnamed_mut(&mut self, i: &mut FieldsUnnamed) {
- visit_fields_unnamed_mut(self, i);
+ visit_fields_unnamed_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_file_mut(&mut self, i: &mut File) {
- visit_file_mut(self, i);
+ visit_file_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_fn_arg_mut(&mut self, i: &mut FnArg) {
- visit_fn_arg_mut(self, i);
+ visit_fn_arg_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_foreign_item_mut(&mut self, i: &mut ForeignItem) {
- visit_foreign_item_mut(self, i);
+ visit_foreign_item_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_foreign_item_fn_mut(&mut self, i: &mut ForeignItemFn) {
- visit_foreign_item_fn_mut(self, i);
+ visit_foreign_item_fn_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_foreign_item_macro_mut(&mut self, i: &mut ForeignItemMacro) {
- visit_foreign_item_macro_mut(self, i);
+ visit_foreign_item_macro_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_foreign_item_static_mut(&mut self, i: &mut ForeignItemStatic) {
- visit_foreign_item_static_mut(self, i);
+ visit_foreign_item_static_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_foreign_item_type_mut(&mut self, i: &mut ForeignItemType) {
- visit_foreign_item_type_mut(self, i);
+ visit_foreign_item_type_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_generic_argument_mut(&mut self, i: &mut GenericArgument) {
- visit_generic_argument_mut(self, i);
+ visit_generic_argument_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_generic_method_argument_mut(&mut self, i: &mut GenericMethodArgument) {
- visit_generic_method_argument_mut(self, i);
+ visit_generic_method_argument_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_generic_param_mut(&mut self, i: &mut GenericParam) {
- visit_generic_param_mut(self, i);
+ visit_generic_param_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_generics_mut(&mut self, i: &mut Generics) {
- visit_generics_mut(self, i);
+ visit_generics_mut(self, i)
}
fn visit_ident_mut(&mut self, i: &mut Ident) {
- visit_ident_mut(self, i);
+ visit_ident_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_impl_item_mut(&mut self, i: &mut ImplItem) {
- visit_impl_item_mut(self, i);
+ visit_impl_item_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_impl_item_const_mut(&mut self, i: &mut ImplItemConst) {
- visit_impl_item_const_mut(self, i);
+ visit_impl_item_const_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_impl_item_macro_mut(&mut self, i: &mut ImplItemMacro) {
- visit_impl_item_macro_mut(self, i);
+ visit_impl_item_macro_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_impl_item_method_mut(&mut self, i: &mut ImplItemMethod) {
- visit_impl_item_method_mut(self, i);
+ visit_impl_item_method_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_impl_item_type_mut(&mut self, i: &mut ImplItemType) {
- visit_impl_item_type_mut(self, i);
+ visit_impl_item_type_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_index_mut(&mut self, i: &mut Index) {
- visit_index_mut(self, i);
+ visit_index_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_mut(&mut self, i: &mut Item) {
- visit_item_mut(self, i);
+ visit_item_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_const_mut(&mut self, i: &mut ItemConst) {
- visit_item_const_mut(self, i);
+ visit_item_const_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_enum_mut(&mut self, i: &mut ItemEnum) {
- visit_item_enum_mut(self, i);
+ visit_item_enum_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_extern_crate_mut(&mut self, i: &mut ItemExternCrate) {
- visit_item_extern_crate_mut(self, i);
+ visit_item_extern_crate_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_fn_mut(&mut self, i: &mut ItemFn) {
- visit_item_fn_mut(self, i);
+ visit_item_fn_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_foreign_mod_mut(&mut self, i: &mut ItemForeignMod) {
- visit_item_foreign_mod_mut(self, i);
+ visit_item_foreign_mod_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_impl_mut(&mut self, i: &mut ItemImpl) {
- visit_item_impl_mut(self, i);
+ visit_item_impl_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_macro_mut(&mut self, i: &mut ItemMacro) {
- visit_item_macro_mut(self, i);
+ visit_item_macro_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_macro2_mut(&mut self, i: &mut ItemMacro2) {
- visit_item_macro2_mut(self, i);
+ visit_item_macro2_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_mod_mut(&mut self, i: &mut ItemMod) {
- visit_item_mod_mut(self, i);
+ visit_item_mod_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_static_mut(&mut self, i: &mut ItemStatic) {
- visit_item_static_mut(self, i);
+ visit_item_static_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_struct_mut(&mut self, i: &mut ItemStruct) {
- visit_item_struct_mut(self, i);
+ visit_item_struct_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_trait_mut(&mut self, i: &mut ItemTrait) {
- visit_item_trait_mut(self, i);
+ visit_item_trait_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_trait_alias_mut(&mut self, i: &mut ItemTraitAlias) {
- visit_item_trait_alias_mut(self, i);
+ visit_item_trait_alias_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_type_mut(&mut self, i: &mut ItemType) {
- visit_item_type_mut(self, i);
+ visit_item_type_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_union_mut(&mut self, i: &mut ItemUnion) {
- visit_item_union_mut(self, i);
+ visit_item_union_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_item_use_mut(&mut self, i: &mut ItemUse) {
- visit_item_use_mut(self, i);
+ visit_item_use_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_label_mut(&mut self, i: &mut Label) {
- visit_label_mut(self, i);
+ visit_label_mut(self, i)
}
fn visit_lifetime_mut(&mut self, i: &mut Lifetime) {
- visit_lifetime_mut(self, i);
+ visit_lifetime_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_lifetime_def_mut(&mut self, i: &mut LifetimeDef) {
- visit_lifetime_def_mut(self, i);
+ visit_lifetime_def_mut(self, i)
}
fn visit_lit_mut(&mut self, i: &mut Lit) {
- visit_lit_mut(self, i);
+ visit_lit_mut(self, i)
}
fn visit_lit_bool_mut(&mut self, i: &mut LitBool) {
- visit_lit_bool_mut(self, i);
+ visit_lit_bool_mut(self, i)
}
fn visit_lit_byte_mut(&mut self, i: &mut LitByte) {
- visit_lit_byte_mut(self, i);
+ visit_lit_byte_mut(self, i)
}
fn visit_lit_byte_str_mut(&mut self, i: &mut LitByteStr) {
- visit_lit_byte_str_mut(self, i);
+ visit_lit_byte_str_mut(self, i)
}
fn visit_lit_char_mut(&mut self, i: &mut LitChar) {
- visit_lit_char_mut(self, i);
+ visit_lit_char_mut(self, i)
}
fn visit_lit_float_mut(&mut self, i: &mut LitFloat) {
- visit_lit_float_mut(self, i);
+ visit_lit_float_mut(self, i)
}
fn visit_lit_int_mut(&mut self, i: &mut LitInt) {
- visit_lit_int_mut(self, i);
+ visit_lit_int_mut(self, i)
}
fn visit_lit_str_mut(&mut self, i: &mut LitStr) {
- visit_lit_str_mut(self, i);
+ visit_lit_str_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_local_mut(&mut self, i: &mut Local) {
- visit_local_mut(self, i);
+ visit_local_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_macro_mut(&mut self, i: &mut Macro) {
- visit_macro_mut(self, i);
+ visit_macro_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_macro_delimiter_mut(&mut self, i: &mut MacroDelimiter) {
- visit_macro_delimiter_mut(self, i);
+ visit_macro_delimiter_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_member_mut(&mut self, i: &mut Member) {
- visit_member_mut(self, i);
+ visit_member_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_meta_mut(&mut self, i: &mut Meta) {
- visit_meta_mut(self, i);
+ visit_meta_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_meta_list_mut(&mut self, i: &mut MetaList) {
- visit_meta_list_mut(self, i);
+ visit_meta_list_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_meta_name_value_mut(&mut self, i: &mut MetaNameValue) {
- visit_meta_name_value_mut(self, i);
+ visit_meta_name_value_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_method_turbofish_mut(&mut self, i: &mut MethodTurbofish) {
- visit_method_turbofish_mut(self, i);
+ visit_method_turbofish_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_nested_meta_mut(&mut self, i: &mut NestedMeta) {
- visit_nested_meta_mut(self, i);
+ visit_nested_meta_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
- fn visit_parenthesized_generic_arguments_mut(
- &mut self,
- i: &mut ParenthesizedGenericArguments,
- ) {
- visit_parenthesized_generic_arguments_mut(self, i);
+ fn visit_parenthesized_generic_arguments_mut(&mut self, i: &mut ParenthesizedGenericArguments) {
+ visit_parenthesized_generic_arguments_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_mut(&mut self, i: &mut Pat) {
- visit_pat_mut(self, i);
+ visit_pat_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_box_mut(&mut self, i: &mut PatBox) {
- visit_pat_box_mut(self, i);
+ visit_pat_box_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_ident_mut(&mut self, i: &mut PatIdent) {
- visit_pat_ident_mut(self, i);
+ visit_pat_ident_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_lit_mut(&mut self, i: &mut PatLit) {
- visit_pat_lit_mut(self, i);
+ visit_pat_lit_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_macro_mut(&mut self, i: &mut PatMacro) {
- visit_pat_macro_mut(self, i);
+ visit_pat_macro_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_or_mut(&mut self, i: &mut PatOr) {
- visit_pat_or_mut(self, i);
+ visit_pat_or_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_path_mut(&mut self, i: &mut PatPath) {
- visit_pat_path_mut(self, i);
+ visit_pat_path_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_range_mut(&mut self, i: &mut PatRange) {
- visit_pat_range_mut(self, i);
+ visit_pat_range_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_reference_mut(&mut self, i: &mut PatReference) {
- visit_pat_reference_mut(self, i);
+ visit_pat_reference_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_rest_mut(&mut self, i: &mut PatRest) {
- visit_pat_rest_mut(self, i);
+ visit_pat_rest_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_slice_mut(&mut self, i: &mut PatSlice) {
- visit_pat_slice_mut(self, i);
+ visit_pat_slice_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_struct_mut(&mut self, i: &mut PatStruct) {
- visit_pat_struct_mut(self, i);
+ visit_pat_struct_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_tuple_mut(&mut self, i: &mut PatTuple) {
- visit_pat_tuple_mut(self, i);
+ visit_pat_tuple_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_tuple_struct_mut(&mut self, i: &mut PatTupleStruct) {
- visit_pat_tuple_struct_mut(self, i);
+ visit_pat_tuple_struct_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_type_mut(&mut self, i: &mut PatType) {
- visit_pat_type_mut(self, i);
+ visit_pat_type_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_pat_wild_mut(&mut self, i: &mut PatWild) {
- visit_pat_wild_mut(self, i);
+ visit_pat_wild_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_path_mut(&mut self, i: &mut Path) {
- visit_path_mut(self, i);
+ visit_path_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_path_arguments_mut(&mut self, i: &mut PathArguments) {
- visit_path_arguments_mut(self, i);
+ visit_path_arguments_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_path_segment_mut(&mut self, i: &mut PathSegment) {
- visit_path_segment_mut(self, i);
+ visit_path_segment_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_predicate_eq_mut(&mut self, i: &mut PredicateEq) {
- visit_predicate_eq_mut(self, i);
+ visit_predicate_eq_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_predicate_lifetime_mut(&mut self, i: &mut PredicateLifetime) {
- visit_predicate_lifetime_mut(self, i);
+ visit_predicate_lifetime_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_predicate_type_mut(&mut self, i: &mut PredicateType) {
- visit_predicate_type_mut(self, i);
+ visit_predicate_type_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_qself_mut(&mut self, i: &mut QSelf) {
- visit_qself_mut(self, i);
+ visit_qself_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_range_limits_mut(&mut self, i: &mut RangeLimits) {
- visit_range_limits_mut(self, i);
+ visit_range_limits_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_receiver_mut(&mut self, i: &mut Receiver) {
- visit_receiver_mut(self, i);
+ visit_receiver_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_return_type_mut(&mut self, i: &mut ReturnType) {
- visit_return_type_mut(self, i);
+ visit_return_type_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_signature_mut(&mut self, i: &mut Signature) {
- visit_signature_mut(self, i);
+ visit_signature_mut(self, i)
}
fn visit_span_mut(&mut self, i: &mut Span) {
- visit_span_mut(self, i);
+ visit_span_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_stmt_mut(&mut self, i: &mut Stmt) {
- visit_stmt_mut(self, i);
+ visit_stmt_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_trait_bound_mut(&mut self, i: &mut TraitBound) {
- visit_trait_bound_mut(self, i);
+ visit_trait_bound_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_trait_bound_modifier_mut(&mut self, i: &mut TraitBoundModifier) {
- visit_trait_bound_modifier_mut(self, i);
+ visit_trait_bound_modifier_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_trait_item_mut(&mut self, i: &mut TraitItem) {
- visit_trait_item_mut(self, i);
+ visit_trait_item_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_trait_item_const_mut(&mut self, i: &mut TraitItemConst) {
- visit_trait_item_const_mut(self, i);
+ visit_trait_item_const_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_trait_item_macro_mut(&mut self, i: &mut TraitItemMacro) {
- visit_trait_item_macro_mut(self, i);
+ visit_trait_item_macro_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_trait_item_method_mut(&mut self, i: &mut TraitItemMethod) {
- visit_trait_item_method_mut(self, i);
+ visit_trait_item_method_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_trait_item_type_mut(&mut self, i: &mut TraitItemType) {
- visit_trait_item_type_mut(self, i);
+ visit_trait_item_type_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_mut(&mut self, i: &mut Type) {
- visit_type_mut(self, i);
+ visit_type_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_array_mut(&mut self, i: &mut TypeArray) {
- visit_type_array_mut(self, i);
+ visit_type_array_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_bare_fn_mut(&mut self, i: &mut TypeBareFn) {
- visit_type_bare_fn_mut(self, i);
+ visit_type_bare_fn_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_group_mut(&mut self, i: &mut TypeGroup) {
- visit_type_group_mut(self, i);
+ visit_type_group_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_impl_trait_mut(&mut self, i: &mut TypeImplTrait) {
- visit_type_impl_trait_mut(self, i);
+ visit_type_impl_trait_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_infer_mut(&mut self, i: &mut TypeInfer) {
- visit_type_infer_mut(self, i);
+ visit_type_infer_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_macro_mut(&mut self, i: &mut TypeMacro) {
- visit_type_macro_mut(self, i);
+ visit_type_macro_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_never_mut(&mut self, i: &mut TypeNever) {
- visit_type_never_mut(self, i);
+ visit_type_never_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_param_mut(&mut self, i: &mut TypeParam) {
- visit_type_param_mut(self, i);
+ visit_type_param_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_param_bound_mut(&mut self, i: &mut TypeParamBound) {
- visit_type_param_bound_mut(self, i);
+ visit_type_param_bound_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_paren_mut(&mut self, i: &mut TypeParen) {
- visit_type_paren_mut(self, i);
+ visit_type_paren_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_path_mut(&mut self, i: &mut TypePath) {
- visit_type_path_mut(self, i);
+ visit_type_path_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_ptr_mut(&mut self, i: &mut TypePtr) {
- visit_type_ptr_mut(self, i);
+ visit_type_ptr_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_reference_mut(&mut self, i: &mut TypeReference) {
- visit_type_reference_mut(self, i);
+ visit_type_reference_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_slice_mut(&mut self, i: &mut TypeSlice) {
- visit_type_slice_mut(self, i);
+ visit_type_slice_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_trait_object_mut(&mut self, i: &mut TypeTraitObject) {
- visit_type_trait_object_mut(self, i);
+ visit_type_trait_object_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_type_tuple_mut(&mut self, i: &mut TypeTuple) {
- visit_type_tuple_mut(self, i);
+ visit_type_tuple_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_un_op_mut(&mut self, i: &mut UnOp) {
- visit_un_op_mut(self, i);
+ visit_un_op_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_use_glob_mut(&mut self, i: &mut UseGlob) {
- visit_use_glob_mut(self, i);
+ visit_use_glob_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_use_group_mut(&mut self, i: &mut UseGroup) {
- visit_use_group_mut(self, i);
+ visit_use_group_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_use_name_mut(&mut self, i: &mut UseName) {
- visit_use_name_mut(self, i);
+ visit_use_name_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_use_path_mut(&mut self, i: &mut UsePath) {
- visit_use_path_mut(self, i);
+ visit_use_path_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_use_rename_mut(&mut self, i: &mut UseRename) {
- visit_use_rename_mut(self, i);
+ visit_use_rename_mut(self, i)
}
#[cfg(feature = "full")]
fn visit_use_tree_mut(&mut self, i: &mut UseTree) {
- visit_use_tree_mut(self, i);
+ visit_use_tree_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_variadic_mut(&mut self, i: &mut Variadic) {
- visit_variadic_mut(self, i);
+ visit_variadic_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_variant_mut(&mut self, i: &mut Variant) {
- visit_variant_mut(self, i);
+ visit_variant_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_vis_crate_mut(&mut self, i: &mut VisCrate) {
- visit_vis_crate_mut(self, i);
+ visit_vis_crate_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_vis_public_mut(&mut self, i: &mut VisPublic) {
- visit_vis_public_mut(self, i);
+ visit_vis_public_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_vis_restricted_mut(&mut self, i: &mut VisRestricted) {
- visit_vis_restricted_mut(self, i);
+ visit_vis_restricted_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_visibility_mut(&mut self, i: &mut Visibility) {
- visit_visibility_mut(self, i);
+ visit_visibility_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_where_clause_mut(&mut self, i: &mut WhereClause) {
- visit_where_clause_mut(self, i);
+ visit_where_clause_mut(self, i)
}
#[cfg(any(feature = "derive", feature = "full"))]
fn visit_where_predicate_mut(&mut self, i: &mut WherePredicate) {
- visit_where_predicate_mut(self, i);
+ visit_where_predicate_mut(self, i)
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -783,20 +780,19 @@ where
{
tokens_helper(v, &mut node.extern_token.span);
if let Some(it) = &mut node.name {
- v.visit_lit_str_mut(it);
- }
+ v.visit_lit_str_mut(it)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_angle_bracketed_generic_arguments_mut<V>(
v: &mut V,
node: &mut AngleBracketedGenericArguments,
-)
-where
+) where
V: VisitMut + ?Sized,
{
if let Some(it) = &mut node.colon2_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
tokens_helper(v, &mut node.lt_token.spans);
for el in Punctuated::pairs_mut(&mut node.args) {
let (it, p) = el.into_tuple();
@@ -813,18 +809,18 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_pat_mut(&mut node.pat);
if let Some(it) = &mut node.guard {
tokens_helper(v, &mut (it).0.span);
v.visit_expr_mut(&mut *(it).1);
- }
+ };
tokens_helper(v, &mut node.fat_arrow_token.spans);
v.visit_expr_mut(&mut *node.body);
if let Some(it) = &mut node.comma {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_attr_style_mut<V>(v: &mut V, node: &mut AttrStyle)
@@ -855,12 +851,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.name {
v.visit_ident_mut(&mut (it).0);
tokens_helper(v, &mut (it).1.spans);
- }
+ };
v.visit_type_mut(&mut node.ty);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -971,7 +967,7 @@ where
{
tokens_helper(v, &mut node.brace_token.span);
for it in &mut node.stmts {
- v.visit_stmt_mut(it);
+ v.visit_stmt_mut(it)
}
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -996,18 +992,18 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.const_token.span);
v.visit_ident_mut(&mut node.ident);
tokens_helper(v, &mut node.colon_token.spans);
v.visit_type_mut(&mut node.ty);
if let Some(it) = &mut node.eq_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
if let Some(it) = &mut node.default {
- v.visit_expr_mut(it);
- }
+ v.visit_expr_mut(it)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_constraint_mut<V>(v: &mut V, node: &mut Constraint)
@@ -1064,8 +1060,8 @@ where
tokens_helper(v, &mut node.struct_token.span);
v.visit_fields_mut(&mut node.fields);
if let Some(it) = &mut node.semi_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
}
#[cfg(feature = "derive")]
pub fn visit_data_union_mut<V>(v: &mut V, node: &mut DataUnion)
@@ -1081,7 +1077,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
v.visit_ident_mut(&mut node.ident);
@@ -1223,7 +1219,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.bracket_token.span);
for el in Punctuated::pairs_mut(&mut node.elems) {
@@ -1240,7 +1236,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.left);
tokens_helper(v, &mut node.eq_token.spans);
@@ -1252,7 +1248,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.left);
v.visit_bin_op_mut(&mut node.op);
@@ -1264,12 +1260,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.async_token.span);
if let Some(it) = &mut node.capture {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
v.visit_block_mut(&mut node.block);
}
#[cfg(feature = "full")]
@@ -1278,7 +1274,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.base);
tokens_helper(v, &mut node.dot_token.spans);
@@ -1290,7 +1286,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.left);
v.visit_bin_op_mut(&mut node.op);
@@ -1302,11 +1298,11 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.label {
- v.visit_label_mut(it);
- }
+ v.visit_label_mut(it)
+ };
v.visit_block_mut(&mut node.block);
}
#[cfg(feature = "full")]
@@ -1315,7 +1311,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.box_token.span);
v.visit_expr_mut(&mut *node.expr);
@@ -1326,15 +1322,15 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.break_token.span);
if let Some(it) = &mut node.label {
- v.visit_lifetime_mut(it);
- }
+ v.visit_lifetime_mut(it)
+ };
if let Some(it) = &mut node.expr {
- v.visit_expr_mut(&mut **it);
- }
+ v.visit_expr_mut(&mut **it)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_expr_call_mut<V>(v: &mut V, node: &mut ExprCall)
@@ -1342,7 +1338,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.func);
tokens_helper(v, &mut node.paren_token.span);
@@ -1360,7 +1356,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.expr);
tokens_helper(v, &mut node.as_token.span);
@@ -1372,17 +1368,17 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
- }
- if let Some(it) = &mut node.movability {
- tokens_helper(v, &mut it.span);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.asyncness {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
+ if let Some(it) = &mut node.movability {
+ tokens_helper(v, &mut it.span)
+ };
if let Some(it) = &mut node.capture {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
tokens_helper(v, &mut node.or1_token.spans);
for el in Punctuated::pairs_mut(&mut node.inputs) {
let (it, p) = el.into_tuple();
@@ -1401,12 +1397,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.continue_token.span);
if let Some(it) = &mut node.label {
- v.visit_lifetime_mut(it);
- }
+ v.visit_lifetime_mut(it)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_expr_field_mut<V>(v: &mut V, node: &mut ExprField)
@@ -1414,7 +1410,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.base);
tokens_helper(v, &mut node.dot_token.spans);
@@ -1426,11 +1422,11 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.label {
- v.visit_label_mut(it);
- }
+ v.visit_label_mut(it)
+ };
tokens_helper(v, &mut node.for_token.span);
v.visit_pat_mut(&mut node.pat);
tokens_helper(v, &mut node.in_token.span);
@@ -1443,7 +1439,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.group_token.span);
v.visit_expr_mut(&mut *node.expr);
@@ -1454,7 +1450,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.if_token.span);
v.visit_expr_mut(&mut *node.cond);
@@ -1462,7 +1458,7 @@ where
if let Some(it) = &mut node.else_branch {
tokens_helper(v, &mut (it).0.span);
v.visit_expr_mut(&mut *(it).1);
- }
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_expr_index_mut<V>(v: &mut V, node: &mut ExprIndex)
@@ -1470,7 +1466,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.expr);
tokens_helper(v, &mut node.bracket_token.span);
@@ -1482,7 +1478,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.let_token.span);
v.visit_pat_mut(&mut node.pat);
@@ -1495,7 +1491,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_lit_mut(&mut node.lit);
}
@@ -1505,11 +1501,11 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.label {
- v.visit_label_mut(it);
- }
+ v.visit_label_mut(it)
+ };
tokens_helper(v, &mut node.loop_token.span);
v.visit_block_mut(&mut node.body);
}
@@ -1519,7 +1515,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_macro_mut(&mut node.mac);
}
@@ -1529,13 +1525,13 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.match_token.span);
v.visit_expr_mut(&mut *node.expr);
tokens_helper(v, &mut node.brace_token.span);
for it in &mut node.arms {
- v.visit_arm_mut(it);
+ v.visit_arm_mut(it)
}
}
#[cfg(feature = "full")]
@@ -1544,14 +1540,14 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.receiver);
tokens_helper(v, &mut node.dot_token.spans);
v.visit_ident_mut(&mut node.method);
if let Some(it) = &mut node.turbofish {
- v.visit_method_turbofish_mut(it);
- }
+ v.visit_method_turbofish_mut(it)
+ };
tokens_helper(v, &mut node.paren_token.span);
for el in Punctuated::pairs_mut(&mut node.args) {
let (it, p) = el.into_tuple();
@@ -1567,7 +1563,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.paren_token.span);
v.visit_expr_mut(&mut *node.expr);
@@ -1578,11 +1574,11 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.qself {
- v.visit_qself_mut(it);
- }
+ v.visit_qself_mut(it)
+ };
v.visit_path_mut(&mut node.path);
}
#[cfg(feature = "full")]
@@ -1591,15 +1587,15 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.from {
- v.visit_expr_mut(&mut **it);
- }
+ v.visit_expr_mut(&mut **it)
+ };
v.visit_range_limits_mut(&mut node.limits);
if let Some(it) = &mut node.to {
- v.visit_expr_mut(&mut **it);
- }
+ v.visit_expr_mut(&mut **it)
+ };
}
#[cfg(feature = "full")]
pub fn visit_expr_reference_mut<V>(v: &mut V, node: &mut ExprReference)
@@ -1607,12 +1603,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.and_token.spans);
if let Some(it) = &mut node.mutability {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
v.visit_expr_mut(&mut *node.expr);
}
#[cfg(feature = "full")]
@@ -1621,7 +1617,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.bracket_token.span);
v.visit_expr_mut(&mut *node.expr);
@@ -1634,12 +1630,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.return_token.span);
if let Some(it) = &mut node.expr {
- v.visit_expr_mut(&mut **it);
- }
+ v.visit_expr_mut(&mut **it)
+ };
}
#[cfg(feature = "full")]
pub fn visit_expr_struct_mut<V>(v: &mut V, node: &mut ExprStruct)
@@ -1647,7 +1643,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_path_mut(&mut node.path);
tokens_helper(v, &mut node.brace_token.span);
@@ -1659,11 +1655,11 @@ where
}
}
if let Some(it) = &mut node.dot2_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
if let Some(it) = &mut node.rest {
- v.visit_expr_mut(&mut **it);
- }
+ v.visit_expr_mut(&mut **it)
+ };
}
#[cfg(feature = "full")]
pub fn visit_expr_try_mut<V>(v: &mut V, node: &mut ExprTry)
@@ -1671,7 +1667,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.expr);
tokens_helper(v, &mut node.question_token.spans);
@@ -1682,7 +1678,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.try_token.span);
v.visit_block_mut(&mut node.block);
@@ -1693,7 +1689,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.paren_token.span);
for el in Punctuated::pairs_mut(&mut node.elems) {
@@ -1710,7 +1706,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.expr);
tokens_helper(v, &mut node.colon_token.spans);
@@ -1722,7 +1718,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_un_op_mut(&mut node.op);
v.visit_expr_mut(&mut *node.expr);
@@ -1733,7 +1729,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.unsafe_token.span);
v.visit_block_mut(&mut node.block);
@@ -1744,11 +1740,11 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.label {
- v.visit_label_mut(it);
- }
+ v.visit_label_mut(it)
+ };
tokens_helper(v, &mut node.while_token.span);
v.visit_expr_mut(&mut *node.cond);
v.visit_block_mut(&mut node.body);
@@ -1759,12 +1755,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.yield_token.span);
if let Some(it) = &mut node.expr {
- v.visit_expr_mut(&mut **it);
- }
+ v.visit_expr_mut(&mut **it)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_field_mut<V>(v: &mut V, node: &mut Field)
@@ -1772,15 +1768,15 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
if let Some(it) = &mut node.ident {
- v.visit_ident_mut(it);
- }
+ v.visit_ident_mut(it)
+ };
if let Some(it) = &mut node.colon_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
v.visit_type_mut(&mut node.ty);
}
#[cfg(feature = "full")]
@@ -1789,12 +1785,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_member_mut(&mut node.member);
if let Some(it) = &mut node.colon_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
v.visit_pat_mut(&mut *node.pat);
}
#[cfg(feature = "full")]
@@ -1803,12 +1799,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_member_mut(&mut node.member);
if let Some(it) = &mut node.colon_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
v.visit_expr_mut(&mut node.expr);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -1861,10 +1857,10 @@ where
{
skip!(node.shebang);
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
for it in &mut node.items {
- v.visit_item_mut(it);
+ v.visit_item_mut(it)
}
}
#[cfg(feature = "full")]
@@ -1911,7 +1907,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
v.visit_signature_mut(&mut node.sig);
@@ -1923,12 +1919,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_macro_mut(&mut node.mac);
if let Some(it) = &mut node.semi_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_foreign_item_static_mut<V>(v: &mut V, node: &mut ForeignItemStatic)
@@ -1936,13 +1932,13 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.static_token.span);
if let Some(it) = &mut node.mutability {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
v.visit_ident_mut(&mut node.ident);
tokens_helper(v, &mut node.colon_token.spans);
v.visit_type_mut(&mut *node.ty);
@@ -1954,7 +1950,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.type_token.span);
@@ -2021,8 +2017,8 @@ where
V: VisitMut + ?Sized,
{
if let Some(it) = &mut node.lt_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
for el in Punctuated::pairs_mut(&mut node.params) {
let (it, p) = el.into_tuple();
v.visit_generic_param_mut(it);
@@ -2031,11 +2027,11 @@ where
}
}
if let Some(it) = &mut node.gt_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
if let Some(it) = &mut node.where_clause {
- v.visit_where_clause_mut(it);
- }
+ v.visit_where_clause_mut(it)
+ };
}
pub fn visit_ident_mut<V>(v: &mut V, node: &mut Ident)
where
@@ -2075,12 +2071,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
if let Some(it) = &mut node.defaultness {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
tokens_helper(v, &mut node.const_token.span);
v.visit_ident_mut(&mut node.ident);
tokens_helper(v, &mut node.colon_token.spans);
@@ -2095,12 +2091,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_macro_mut(&mut node.mac);
if let Some(it) = &mut node.semi_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_impl_item_method_mut<V>(v: &mut V, node: &mut ImplItemMethod)
@@ -2108,12 +2104,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
if let Some(it) = &mut node.defaultness {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
v.visit_signature_mut(&mut node.sig);
v.visit_block_mut(&mut node.block);
}
@@ -2123,12 +2119,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
if let Some(it) = &mut node.defaultness {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
tokens_helper(v, &mut node.type_token.span);
v.visit_ident_mut(&mut node.ident);
v.visit_generics_mut(&mut node.generics);
@@ -2210,7 +2206,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.const_token.span);
@@ -2227,7 +2223,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.enum_token.span);
@@ -2248,7 +2244,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.extern_token.span);
@@ -2257,7 +2253,7 @@ where
if let Some(it) = &mut node.rename {
tokens_helper(v, &mut (it).0.span);
v.visit_ident_mut(&mut (it).1);
- }
+ };
tokens_helper(v, &mut node.semi_token.spans);
}
#[cfg(feature = "full")]
@@ -2266,7 +2262,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
v.visit_signature_mut(&mut node.sig);
@@ -2278,12 +2274,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_abi_mut(&mut node.abi);
tokens_helper(v, &mut node.brace_token.span);
for it in &mut node.items {
- v.visit_foreign_item_mut(it);
+ v.visit_foreign_item_mut(it)
}
}
#[cfg(feature = "full")]
@@ -2292,27 +2288,27 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.defaultness {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
if let Some(it) = &mut node.unsafety {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
tokens_helper(v, &mut node.impl_token.span);
v.visit_generics_mut(&mut node.generics);
if let Some(it) = &mut node.trait_ {
if let Some(it) = &mut (it).0 {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
v.visit_path_mut(&mut (it).1);
tokens_helper(v, &mut (it).2.span);
- }
+ };
v.visit_type_mut(&mut *node.self_ty);
tokens_helper(v, &mut node.brace_token.span);
for it in &mut node.items {
- v.visit_impl_item_mut(it);
+ v.visit_impl_item_mut(it)
}
}
#[cfg(feature = "full")]
@@ -2321,15 +2317,15 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.ident {
- v.visit_ident_mut(it);
- }
+ v.visit_ident_mut(it)
+ };
v.visit_macro_mut(&mut node.mac);
if let Some(it) = &mut node.semi_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_item_macro2_mut<V>(v: &mut V, node: &mut ItemMacro2)
@@ -2337,7 +2333,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.macro_token.span);
@@ -2350,7 +2346,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.mod_token.span);
@@ -2358,12 +2354,12 @@ where
if let Some(it) = &mut node.content {
tokens_helper(v, &mut (it).0.span);
for it in &mut (it).1 {
- v.visit_item_mut(it);
+ v.visit_item_mut(it)
}
- }
+ };
if let Some(it) = &mut node.semi {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_item_static_mut<V>(v: &mut V, node: &mut ItemStatic)
@@ -2371,13 +2367,13 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.static_token.span);
if let Some(it) = &mut node.mutability {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
v.visit_ident_mut(&mut node.ident);
tokens_helper(v, &mut node.colon_token.spans);
v.visit_type_mut(&mut *node.ty);
@@ -2391,7 +2387,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.struct_token.span);
@@ -2399,8 +2395,8 @@ where
v.visit_generics_mut(&mut node.generics);
v.visit_fields_mut(&mut node.fields);
if let Some(it) = &mut node.semi_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_item_trait_mut<V>(v: &mut V, node: &mut ItemTrait)
@@ -2408,21 +2404,21 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
if let Some(it) = &mut node.unsafety {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
if let Some(it) = &mut node.auto_token {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
tokens_helper(v, &mut node.trait_token.span);
v.visit_ident_mut(&mut node.ident);
v.visit_generics_mut(&mut node.generics);
if let Some(it) = &mut node.colon_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
for el in Punctuated::pairs_mut(&mut node.supertraits) {
let (it, p) = el.into_tuple();
v.visit_type_param_bound_mut(it);
@@ -2432,7 +2428,7 @@ where
}
tokens_helper(v, &mut node.brace_token.span);
for it in &mut node.items {
- v.visit_trait_item_mut(it);
+ v.visit_trait_item_mut(it)
}
}
#[cfg(feature = "full")]
@@ -2441,7 +2437,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.trait_token.span);
@@ -2463,7 +2459,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.type_token.span);
@@ -2479,7 +2475,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.union_token.span);
@@ -2493,13 +2489,13 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_visibility_mut(&mut node.vis);
tokens_helper(v, &mut node.use_token.span);
if let Some(it) = &mut node.leading_colon {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
v.visit_use_tree_mut(&mut node.tree);
tokens_helper(v, &mut node.semi_token.spans);
}
@@ -2524,12 +2520,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_lifetime_mut(&mut node.lifetime);
if let Some(it) = &mut node.colon_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
for el in Punctuated::pairs_mut(&mut node.bounds) {
let (it, p) = el.into_tuple();
v.visit_lifetime_mut(it);
@@ -2579,41 +2575,47 @@ where
pub fn visit_lit_byte_mut<V>(v: &mut V, node: &mut LitByte)
where
V: VisitMut + ?Sized,
-{}
+{
+}
pub fn visit_lit_byte_str_mut<V>(v: &mut V, node: &mut LitByteStr)
where
V: VisitMut + ?Sized,
-{}
+{
+}
pub fn visit_lit_char_mut<V>(v: &mut V, node: &mut LitChar)
where
V: VisitMut + ?Sized,
-{}
+{
+}
pub fn visit_lit_float_mut<V>(v: &mut V, node: &mut LitFloat)
where
V: VisitMut + ?Sized,
-{}
+{
+}
pub fn visit_lit_int_mut<V>(v: &mut V, node: &mut LitInt)
where
V: VisitMut + ?Sized,
-{}
+{
+}
pub fn visit_lit_str_mut<V>(v: &mut V, node: &mut LitStr)
where
V: VisitMut + ?Sized,
-{}
+{
+}
#[cfg(feature = "full")]
pub fn visit_local_mut<V>(v: &mut V, node: &mut Local)
where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.let_token.span);
v.visit_pat_mut(&mut node.pat);
if let Some(it) = &mut node.init {
tokens_helper(v, &mut (it).0.spans);
v.visit_expr_mut(&mut *(it).1);
- }
+ };
tokens_helper(v, &mut node.semi_token.spans);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -2732,8 +2734,7 @@ where
pub fn visit_parenthesized_generic_arguments_mut<V>(
v: &mut V,
node: &mut ParenthesizedGenericArguments,
-)
-where
+) where
V: VisitMut + ?Sized,
{
tokens_helper(v, &mut node.paren_token.span);
@@ -2809,7 +2810,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.box_token.span);
v.visit_pat_mut(&mut *node.pat);
@@ -2820,19 +2821,19 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.by_ref {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
if let Some(it) = &mut node.mutability {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
v.visit_ident_mut(&mut node.ident);
if let Some(it) = &mut node.subpat {
tokens_helper(v, &mut (it).0.spans);
v.visit_pat_mut(&mut *(it).1);
- }
+ };
}
#[cfg(feature = "full")]
pub fn visit_pat_lit_mut<V>(v: &mut V, node: &mut PatLit)
@@ -2840,7 +2841,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.expr);
}
@@ -2850,7 +2851,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_macro_mut(&mut node.mac);
}
@@ -2860,11 +2861,11 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.leading_vert {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
for el in Punctuated::pairs_mut(&mut node.cases) {
let (it, p) = el.into_tuple();
v.visit_pat_mut(it);
@@ -2879,11 +2880,11 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.qself {
- v.visit_qself_mut(it);
- }
+ v.visit_qself_mut(it)
+ };
v.visit_path_mut(&mut node.path);
}
#[cfg(feature = "full")]
@@ -2892,7 +2893,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_expr_mut(&mut *node.lo);
v.visit_range_limits_mut(&mut node.limits);
@@ -2904,12 +2905,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.and_token.spans);
if let Some(it) = &mut node.mutability {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
v.visit_pat_mut(&mut *node.pat);
}
#[cfg(feature = "full")]
@@ -2918,7 +2919,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.dot2_token.spans);
}
@@ -2928,7 +2929,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.bracket_token.span);
for el in Punctuated::pairs_mut(&mut node.elems) {
@@ -2945,7 +2946,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_path_mut(&mut node.path);
tokens_helper(v, &mut node.brace_token.span);
@@ -2957,8 +2958,8 @@ where
}
}
if let Some(it) = &mut node.dot2_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_pat_tuple_mut<V>(v: &mut V, node: &mut PatTuple)
@@ -2966,7 +2967,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.paren_token.span);
for el in Punctuated::pairs_mut(&mut node.elems) {
@@ -2983,7 +2984,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_path_mut(&mut node.path);
v.visit_pat_tuple_mut(&mut node.pat);
@@ -2994,7 +2995,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_pat_mut(&mut *node.pat);
tokens_helper(v, &mut node.colon_token.spans);
@@ -3006,7 +3007,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.underscore_token.spans);
}
@@ -3016,8 +3017,8 @@ where
V: VisitMut + ?Sized,
{
if let Some(it) = &mut node.leading_colon {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
for el in Punctuated::pairs_mut(&mut node.segments) {
let (it, p) = el.into_tuple();
v.visit_path_segment_mut(it);
@@ -3079,8 +3080,8 @@ where
V: VisitMut + ?Sized,
{
if let Some(it) = &mut node.lifetimes {
- v.visit_bound_lifetimes_mut(it);
- }
+ v.visit_bound_lifetimes_mut(it)
+ };
v.visit_type_mut(&mut node.bounded_ty);
tokens_helper(v, &mut node.colon_token.spans);
for el in Punctuated::pairs_mut(&mut node.bounds) {
@@ -3100,8 +3101,8 @@ where
v.visit_type_mut(&mut *node.ty);
skip!(node.position);
if let Some(it) = &mut node.as_token {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
tokens_helper(v, &mut node.gt_token.spans);
}
#[cfg(feature = "full")]
@@ -3124,17 +3125,17 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
if let Some(it) = &mut node.reference {
tokens_helper(v, &mut (it).0.spans);
if let Some(it) = &mut (it).1 {
- v.visit_lifetime_mut(it);
- }
- }
+ v.visit_lifetime_mut(it)
+ };
+ };
if let Some(it) = &mut node.mutability {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
tokens_helper(v, &mut node.self_token.span);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3156,17 +3157,17 @@ where
V: VisitMut + ?Sized,
{
if let Some(it) = &mut node.constness {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
if let Some(it) = &mut node.asyncness {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
if let Some(it) = &mut node.unsafety {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
if let Some(it) = &mut node.abi {
- v.visit_abi_mut(it);
- }
+ v.visit_abi_mut(it)
+ };
tokens_helper(v, &mut node.fn_token.span);
v.visit_ident_mut(&mut node.ident);
v.visit_generics_mut(&mut node.generics);
@@ -3179,14 +3180,15 @@ where
}
}
if let Some(it) = &mut node.variadic {
- v.visit_variadic_mut(it);
- }
+ v.visit_variadic_mut(it)
+ };
v.visit_return_type_mut(&mut node.output);
}
pub fn visit_span_mut<V>(v: &mut V, node: &mut Span)
where
V: VisitMut + ?Sized,
-{}
+{
+}
#[cfg(feature = "full")]
pub fn visit_stmt_mut<V>(v: &mut V, node: &mut Stmt)
where
@@ -3214,12 +3216,12 @@ where
V: VisitMut + ?Sized,
{
if let Some(it) = &mut node.paren_token {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
v.visit_trait_bound_modifier_mut(&mut node.modifier);
if let Some(it) = &mut node.lifetimes {
- v.visit_bound_lifetimes_mut(it);
- }
+ v.visit_bound_lifetimes_mut(it)
+ };
v.visit_path_mut(&mut node.path);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3264,7 +3266,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.const_token.span);
v.visit_ident_mut(&mut node.ident);
@@ -3273,7 +3275,7 @@ where
if let Some(it) = &mut node.default {
tokens_helper(v, &mut (it).0.spans);
v.visit_expr_mut(&mut (it).1);
- }
+ };
tokens_helper(v, &mut node.semi_token.spans);
}
#[cfg(feature = "full")]
@@ -3282,12 +3284,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_macro_mut(&mut node.mac);
if let Some(it) = &mut node.semi_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_trait_item_method_mut<V>(v: &mut V, node: &mut TraitItemMethod)
@@ -3295,15 +3297,15 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_signature_mut(&mut node.sig);
if let Some(it) = &mut node.default {
- v.visit_block_mut(it);
- }
+ v.visit_block_mut(it)
+ };
if let Some(it) = &mut node.semi_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
}
#[cfg(feature = "full")]
pub fn visit_trait_item_type_mut<V>(v: &mut V, node: &mut TraitItemType)
@@ -3311,14 +3313,14 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.type_token.span);
v.visit_ident_mut(&mut node.ident);
v.visit_generics_mut(&mut node.generics);
if let Some(it) = &mut node.colon_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
for el in Punctuated::pairs_mut(&mut node.bounds) {
let (it, p) = el.into_tuple();
v.visit_type_param_bound_mut(it);
@@ -3329,7 +3331,7 @@ where
if let Some(it) = &mut node.default {
tokens_helper(v, &mut (it).0.spans);
v.visit_type_mut(&mut (it).1);
- }
+ };
tokens_helper(v, &mut node.semi_token.spans);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3402,14 +3404,14 @@ where
V: VisitMut + ?Sized,
{
if let Some(it) = &mut node.lifetimes {
- v.visit_bound_lifetimes_mut(it);
- }
+ v.visit_bound_lifetimes_mut(it)
+ };
if let Some(it) = &mut node.unsafety {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
if let Some(it) = &mut node.abi {
- v.visit_abi_mut(it);
- }
+ v.visit_abi_mut(it)
+ };
tokens_helper(v, &mut node.fn_token.span);
tokens_helper(v, &mut node.paren_token.span);
for el in Punctuated::pairs_mut(&mut node.inputs) {
@@ -3420,8 +3422,8 @@ where
}
}
if let Some(it) = &mut node.variadic {
- v.visit_variadic_mut(it);
- }
+ v.visit_variadic_mut(it)
+ };
v.visit_return_type_mut(&mut node.output);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3473,12 +3475,12 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_ident_mut(&mut node.ident);
if let Some(it) = &mut node.colon_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
for el in Punctuated::pairs_mut(&mut node.bounds) {
let (it, p) = el.into_tuple();
v.visit_type_param_bound_mut(it);
@@ -3487,11 +3489,11 @@ where
}
}
if let Some(it) = &mut node.eq_token {
- tokens_helper(v, &mut it.spans);
- }
+ tokens_helper(v, &mut it.spans)
+ };
if let Some(it) = &mut node.default {
- v.visit_type_mut(it);
- }
+ v.visit_type_mut(it)
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_type_param_bound_mut<V>(v: &mut V, node: &mut TypeParamBound)
@@ -3521,8 +3523,8 @@ where
V: VisitMut + ?Sized,
{
if let Some(it) = &mut node.qself {
- v.visit_qself_mut(it);
- }
+ v.visit_qself_mut(it)
+ };
v.visit_path_mut(&mut node.path);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3532,11 +3534,11 @@ where
{
tokens_helper(v, &mut node.star_token.spans);
if let Some(it) = &mut node.const_token {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
if let Some(it) = &mut node.mutability {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
v.visit_type_mut(&mut *node.elem);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3546,11 +3548,11 @@ where
{
tokens_helper(v, &mut node.and_token.spans);
if let Some(it) = &mut node.lifetime {
- v.visit_lifetime_mut(it);
- }
+ v.visit_lifetime_mut(it)
+ };
if let Some(it) = &mut node.mutability {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
v.visit_type_mut(&mut *node.elem);
}
#[cfg(any(feature = "derive", feature = "full"))]
@@ -3567,8 +3569,8 @@ where
V: VisitMut + ?Sized,
{
if let Some(it) = &mut node.dyn_token {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
for el in Punctuated::pairs_mut(&mut node.bounds) {
let (it, p) = el.into_tuple();
v.visit_type_param_bound_mut(it);
@@ -3683,7 +3685,7 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
tokens_helper(v, &mut node.dots.spans);
}
@@ -3693,14 +3695,14 @@ where
V: VisitMut + ?Sized,
{
for it in &mut node.attrs {
- v.visit_attribute_mut(it);
+ v.visit_attribute_mut(it)
}
v.visit_ident_mut(&mut node.ident);
v.visit_fields_mut(&mut node.fields);
if let Some(it) = &mut node.discriminant {
tokens_helper(v, &mut (it).0.spans);
v.visit_expr_mut(&mut (it).1);
- }
+ };
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_vis_crate_mut<V>(v: &mut V, node: &mut VisCrate)
@@ -3724,8 +3726,8 @@ where
tokens_helper(v, &mut node.pub_token.span);
tokens_helper(v, &mut node.paren_token.span);
if let Some(it) = &mut node.in_token {
- tokens_helper(v, &mut it.span);
- }
+ tokens_helper(v, &mut it.span)
+ };
v.visit_path_mut(&mut *node.path);
}
#[cfg(any(feature = "derive", feature = "full"))]
diff --git a/src/generics.rs b/src/generics.rs
index 9c2802f8..de0772a7 100644
--- a/src/generics.rs
+++ b/src/generics.rs
@@ -172,10 +172,17 @@ impl Generics {
/// Initializes an empty `where`-clause if there is not one present already.
pub fn make_where_clause(&mut self) -> &mut WhereClause {
- self.where_clause.get_or_insert_with(|| WhereClause {
- where_token: <Token![where]>::default(),
- predicates: Punctuated::new(),
- })
+ // This is Option::get_or_insert_with in Rust 1.20.
+ if self.where_clause.is_none() {
+ self.where_clause = Some(WhereClause {
+ where_token: <Token![where]>::default(),
+ predicates: Punctuated::new(),
+ });
+ }
+ match &mut self.where_clause {
+ Some(where_clause) => where_clause,
+ None => unreachable!(),
+ }
}
}
@@ -770,8 +777,8 @@ pub mod parsing {
if input.peek(Token![,]) || input.peek(Token![>]) || input.peek(Token![=]) {
break;
}
- if input.peek(Token![~]) && input.peek2(Token![const]) {
- input.parse::<Token![~]>()?;
+ if input.peek(Token![?]) && input.peek2(Token![const]) {
+ input.parse::<Token![?]>()?;
input.parse::<Token![const]>()?;
is_maybe_const = true;
}
@@ -831,43 +838,15 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for TraitBound {
fn parse(input: ParseStream) -> Result<Self> {
- #[cfg(feature = "full")]
- let tilde_const = if input.peek(Token![~]) && input.peek2(Token![const]) {
- let tilde_token = input.parse::<Token![~]>()?;
- let const_token = input.parse::<Token![const]>()?;
- Some((tilde_token, const_token))
- } else {
- None
- };
-
let modifier: TraitBoundModifier = input.parse()?;
let lifetimes: Option<BoundLifetimes> = input.parse()?;
let mut path: Path = input.parse()?;
- if path.segments.last().unwrap().arguments.is_empty()
- && (input.peek(token::Paren) || input.peek(Token![::]) && input.peek3(token::Paren))
- {
- input.parse::<Option<Token![::]>>()?;
- let args: ParenthesizedGenericArguments = input.parse()?;
- let parenthesized = PathArguments::Parenthesized(args);
+ if path.segments.last().unwrap().arguments.is_empty() && input.peek(token::Paren) {
+ let parenthesized = PathArguments::Parenthesized(input.parse()?);
path.segments.last_mut().unwrap().arguments = parenthesized;
}
- #[cfg(feature = "full")]
- {
- if let Some((tilde_token, const_token)) = tilde_const {
- path.segments.insert(
- 0,
- PathSegment {
- ident: Ident::new("const", const_token.span),
- arguments: PathArguments::None,
- },
- );
- let (_const, punct) = path.segments.pairs_mut().next().unwrap().into_tuple();
- *punct.unwrap() = Token![::](tilde_token.span);
- }
- }
-
Ok(TraitBound {
paren_token: None,
modifier,
@@ -1022,8 +1001,6 @@ mod printing {
use super::*;
use crate::attr::FilterAttrs;
use crate::print::TokensOrDefault;
- #[cfg(feature = "full")]
- use crate::punctuated::Pair;
use proc_macro2::TokenStream;
#[cfg(feature = "full")]
use proc_macro2::TokenTree;
@@ -1218,7 +1195,7 @@ mod printing {
let mut iter = default.clone().into_iter().peekable();
while let Some(token) = iter.next() {
if let TokenTree::Punct(q) = token {
- if q.as_char() == '~' {
+ if q.as_char() == '?' {
if let Some(TokenTree::Ident(c)) = iter.peek() {
if c == "const" {
if self.bounds.is_empty() {
@@ -1244,26 +1221,9 @@ mod printing {
impl ToTokens for TraitBound {
fn to_tokens(&self, tokens: &mut TokenStream) {
let to_tokens = |tokens: &mut TokenStream| {
- #[cfg(feature = "full")]
- let skip = match self.path.segments.pairs().next() {
- Some(Pair::Punctuated(t, p)) if t.ident == "const" => {
- Token![~](p.spans[0]).to_tokens(tokens);
- t.to_tokens(tokens);
- 1
- }
- _ => 0,
- };
self.modifier.to_tokens(tokens);
self.lifetimes.to_tokens(tokens);
- #[cfg(feature = "full")]
- {
- self.path.leading_colon.to_tokens(tokens);
- tokens.append_all(self.path.segments.pairs().skip(skip));
- }
- #[cfg(not(feature = "full"))]
- {
- self.path.to_tokens(tokens);
- }
+ self.path.to_tokens(tokens);
};
match &self.paren_token {
Some(paren) => paren.surround(tokens, to_tokens),
diff --git a/src/item.rs b/src/item.rs
index 917d4f1f..10479ab4 100644
--- a/src/item.rs
+++ b/src/item.rs
@@ -985,6 +985,7 @@ pub mod parsing {
use proc_macro2::{Delimiter, Group, Punct, Spacing, TokenTree};
use std::iter::{self, FromIterator};
+ crate::custom_keyword!(existential);
crate::custom_keyword!(macro_rules);
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
@@ -1099,8 +1100,8 @@ pub mod parsing {
{
input.parse().map(Item::Trait)
} else if lookahead.peek(Token![impl]) {
- let allow_verbatim_impl = true;
- if let Some(item) = parse_impl(input, allow_verbatim_impl)? {
+ let allow_const_impl = true;
+ if let Some(item) = parse_impl(input, allow_const_impl)? {
Ok(Item::Impl(item))
} else {
Ok(Item::Verbatim(verbatim::between(begin, input)))
@@ -1122,6 +1123,8 @@ pub mod parsing {
input.parse().map(Item::Mod)
} else if lookahead.peek(Token![type]) {
parse_item_type(begin, input)
+ } else if lookahead.peek(existential) {
+ input.call(item_existential).map(Item::Verbatim)
} else if lookahead.peek(Token![struct]) {
input.parse().map(Item::Struct)
} else if lookahead.peek(Token![enum]) {
@@ -1135,8 +1138,8 @@ pub mod parsing {
} else if lookahead.peek(Token![impl])
|| lookahead.peek(Token![default]) && !ahead.peek2(Token![!])
{
- let allow_verbatim_impl = true;
- if let Some(item) = parse_impl(input, allow_verbatim_impl)? {
+ let allow_const_impl = true;
+ if let Some(item) = parse_impl(input, allow_const_impl)? {
Ok(Item::Impl(item))
} else {
Ok(Item::Verbatim(verbatim::between(begin, input)))
@@ -1530,17 +1533,17 @@ pub mod parsing {
fn parse_rest_of_fn(
input: ParseStream,
- mut attrs: Vec<Attribute>,
+ outer_attrs: Vec<Attribute>,
vis: Visibility,
sig: Signature,
) -> Result<ItemFn> {
let content;
let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, &mut attrs)?;
+ let inner_attrs = content.call(Attribute::parse_inner)?;
let stmts = content.call(Block::parse_within)?;
Ok(ItemFn {
- attrs,
+ attrs: private::attrs(outer_attrs, inner_attrs),
vis,
sig,
block: Box::new(Block { brace_token, stmts }),
@@ -1666,7 +1669,7 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ItemMod {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let outer_attrs = input.call(Attribute::parse_outer)?;
let vis: Visibility = input.parse()?;
let mod_token: Token![mod] = input.parse()?;
let ident: Ident = input.parse()?;
@@ -1674,7 +1677,7 @@ pub mod parsing {
let lookahead = input.lookahead1();
if lookahead.peek(Token![;]) {
Ok(ItemMod {
- attrs,
+ attrs: outer_attrs,
vis,
mod_token,
ident,
@@ -1684,7 +1687,7 @@ pub mod parsing {
} else if lookahead.peek(token::Brace) {
let content;
let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, &mut attrs)?;
+ let inner_attrs = content.call(Attribute::parse_inner)?;
let mut items = Vec::new();
while !content.is_empty() {
@@ -1692,7 +1695,7 @@ pub mod parsing {
}
Ok(ItemMod {
- attrs,
+ attrs: private::attrs(outer_attrs, inner_attrs),
vis,
mod_token,
ident,
@@ -1708,19 +1711,19 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ItemForeignMod {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let outer_attrs = input.call(Attribute::parse_outer)?;
let abi: Abi = input.parse()?;
let content;
let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, &mut attrs)?;
+ let inner_attrs = content.call(Attribute::parse_inner)?;
let mut items = Vec::new();
while !content.is_empty() {
items.push(content.parse()?);
}
Ok(ItemForeignMod {
- attrs,
+ attrs: private::attrs(outer_attrs, inner_attrs),
abi,
brace_token,
items,
@@ -1805,7 +1808,7 @@ pub mod parsing {
#[cfg(not(test))]
_ => unreachable!(),
};
- attrs.append(item_attrs);
+ attrs.extend(item_attrs.drain(..));
*item_attrs = attrs;
Ok(item)
@@ -1956,16 +1959,62 @@ pub mod parsing {
}
}
+ #[cfg(not(feature = "printing"))]
+ fn item_existential(input: ParseStream) -> Result<TokenStream> {
+ Err(input.error("existential type is not supported"))
+ }
+
+ #[cfg(feature = "printing")]
+ fn item_existential(input: ParseStream) -> Result<TokenStream> {
+ use crate::attr::FilterAttrs;
+ use quote::{ToTokens, TokenStreamExt};
+
+ let attrs = input.call(Attribute::parse_outer)?;
+ let vis: Visibility = input.parse()?;
+ let existential_token: existential = input.parse()?;
+ let type_token: Token![type] = input.parse()?;
+ let ident: Ident = input.parse()?;
+
+ let mut generics: Generics = input.parse()?;
+ generics.where_clause = input.parse()?;
+
+ let colon_token: Token![:] = input.parse()?;
+
+ let mut bounds = Punctuated::new();
+ while !input.peek(Token![;]) {
+ if !bounds.is_empty() {
+ bounds.push_punct(input.parse::<Token![+]>()?);
+ }
+ bounds.push_value(input.parse::<TypeParamBound>()?);
+ }
+
+ let semi_token: Token![;] = input.parse()?;
+
+ let mut tokens = TokenStream::new();
+ tokens.append_all(attrs.outer());
+ vis.to_tokens(&mut tokens);
+ existential_token.to_tokens(&mut tokens);
+ type_token.to_tokens(&mut tokens);
+ ident.to_tokens(&mut tokens);
+ generics.to_tokens(&mut tokens);
+ generics.where_clause.to_tokens(&mut tokens);
+ if !bounds.is_empty() {
+ colon_token.to_tokens(&mut tokens);
+ bounds.to_tokens(&mut tokens);
+ }
+ semi_token.to_tokens(&mut tokens);
+ Ok(tokens)
+ }
+
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ItemStruct {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let attrs = input.call(Attribute::parse_outer)?;
let vis = input.parse::<Visibility>()?;
let struct_token = input.parse::<Token![struct]>()?;
let ident = input.parse::<Ident>()?;
let generics = input.parse::<Generics>()?;
- let (where_clause, fields, semi_token) =
- derive::parsing::data_struct(input, &mut attrs)?;
+ let (where_clause, fields, semi_token) = derive::parsing::data_struct(input)?;
Ok(ItemStruct {
attrs,
vis,
@@ -1984,13 +2033,12 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ItemEnum {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let attrs = input.call(Attribute::parse_outer)?;
let vis = input.parse::<Visibility>()?;
let enum_token = input.parse::<Token![enum]>()?;
let ident = input.parse::<Ident>()?;
let generics = input.parse::<Generics>()?;
- let (where_clause, brace_token, variants) =
- derive::parsing::data_enum(input, &mut attrs)?;
+ let (where_clause, brace_token, variants) = derive::parsing::data_enum(input)?;
Ok(ItemEnum {
attrs,
vis,
@@ -2009,12 +2057,12 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ItemUnion {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let attrs = input.call(Attribute::parse_outer)?;
let vis = input.parse::<Visibility>()?;
let union_token = input.parse::<Token![union]>()?;
let ident = input.parse::<Ident>()?;
let generics = input.parse::<Generics>()?;
- let (where_clause, fields) = derive::parsing::data_union(input, &mut attrs)?;
+ let (where_clause, fields) = derive::parsing::data_union(input)?;
Ok(ItemUnion {
attrs,
vis,
@@ -2082,7 +2130,7 @@ pub mod parsing {
fn parse_rest_of_trait(
input: ParseStream,
- mut attrs: Vec<Attribute>,
+ outer_attrs: Vec<Attribute>,
vis: Visibility,
unsafety: Option<Token![unsafe]>,
auto_token: Option<Token![auto]>,
@@ -2110,14 +2158,14 @@ pub mod parsing {
let content;
let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, &mut attrs)?;
+ let inner_attrs = content.call(Attribute::parse_inner)?;
let mut items = Vec::new();
while !content.is_empty() {
items.push(content.parse()?);
}
Ok(ItemTrait {
- attrs,
+ attrs: private::attrs(outer_attrs, inner_attrs),
vis,
unsafety,
auto_token,
@@ -2243,7 +2291,7 @@ pub mod parsing {
#[cfg(not(test))]
_ => unreachable!(),
};
- attrs.append(item_attrs);
+ attrs.extend(item_attrs.drain(..));
*item_attrs = attrs;
Ok(item)
}
@@ -2282,25 +2330,25 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for TraitItemMethod {
fn parse(input: ParseStream) -> Result<Self> {
- let mut attrs = input.call(Attribute::parse_outer)?;
+ let outer_attrs = input.call(Attribute::parse_outer)?;
let sig: Signature = input.parse()?;
let lookahead = input.lookahead1();
- let (brace_token, stmts, semi_token) = if lookahead.peek(token::Brace) {
+ let (brace_token, inner_attrs, stmts, semi_token) = if lookahead.peek(token::Brace) {
let content;
let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, &mut attrs)?;
+ let inner_attrs = content.call(Attribute::parse_inner)?;
let stmts = content.call(Block::parse_within)?;
- (Some(brace_token), stmts, None)
+ (Some(brace_token), inner_attrs, stmts, None)
} else if lookahead.peek(Token![;]) {
let semi_token: Token![;] = input.parse()?;
- (None, Vec::new(), Some(semi_token))
+ (None, Vec::new(), Vec::new(), Some(semi_token))
} else {
return Err(lookahead.error());
};
Ok(TraitItemMethod {
- attrs,
+ attrs: private::attrs(outer_attrs, inner_attrs),
sig,
default: brace_token.map(|brace_token| Block { brace_token, stmts }),
semi_token,
@@ -2401,14 +2449,13 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ItemImpl {
fn parse(input: ParseStream) -> Result<Self> {
- let allow_verbatim_impl = false;
- parse_impl(input, allow_verbatim_impl).map(Option::unwrap)
+ let allow_const_impl = false;
+ parse_impl(input, allow_const_impl).map(Option::unwrap)
}
}
- fn parse_impl(input: ParseStream, allow_verbatim_impl: bool) -> Result<Option<ItemImpl>> {
- let mut attrs = input.call(Attribute::parse_outer)?;
- let has_visibility = allow_verbatim_impl && input.parse::<Visibility>()?.is_some();
+ fn parse_impl(input: ParseStream, allow_const_impl: bool) -> Result<Option<ItemImpl>> {
+ let outer_attrs = input.call(Attribute::parse_outer)?;
let defaultness: Option<Token![default]> = input.parse()?;
let unsafety: Option<Token![unsafe]> = input.parse()?;
let impl_token: Token![impl] = input.parse()?;
@@ -2419,8 +2466,7 @@ pub mod parsing {
|| (input.peek2(Ident) || input.peek2(Lifetime))
&& (input.peek3(Token![:])
|| input.peek3(Token![,])
- || input.peek3(Token![>])
- || input.peek3(Token![=]))
+ || input.peek3(Token![>]))
|| input.peek2(Token![const]));
let mut generics: Generics = if has_generics {
input.parse()?
@@ -2428,7 +2474,7 @@ pub mod parsing {
Generics::default()
};
- let is_const_impl = allow_verbatim_impl
+ let is_const_impl = allow_const_impl
&& (input.peek(Token![const]) || input.peek(Token![?]) && input.peek2(Token![const]));
if is_const_impl {
input.parse::<Option<Token![?]>>()?;
@@ -2442,8 +2488,6 @@ pub mod parsing {
None
};
- #[cfg(not(feature = "printing"))]
- let first_ty_span = input.span();
let mut first_ty: Type = input.parse()?;
let self_ty: Type;
let trait_;
@@ -2455,20 +2499,15 @@ pub mod parsing {
while let Type::Group(ty) = first_ty_ref {
first_ty_ref = &ty.elem;
}
- if let Type::Path(TypePath { qself: None, .. }) = first_ty_ref {
+ if let Type::Path(_) = first_ty_ref {
while let Type::Group(ty) = first_ty {
first_ty = *ty.elem;
}
if let Type::Path(TypePath { qself: None, path }) = first_ty {
trait_ = Some((polarity, path, for_token));
} else {
- unreachable!();
+ unreachable!()
}
- } else if !allow_verbatim_impl {
- #[cfg(feature = "printing")]
- return Err(Error::new_spanned(first_ty_ref, "expected trait path"));
- #[cfg(not(feature = "printing"))]
- return Err(Error::new(first_ty_span, "expected trait path"));
} else {
trait_ = None;
}
@@ -2486,18 +2525,18 @@ pub mod parsing {
let content;
let brace_token = braced!(content in input);
- attr::parsing::parse_inner(&content, &mut attrs)?;
+ let inner_attrs = content.call(Attribute::parse_inner)?;
let mut items = Vec::new();
while !content.is_empty() {
items.push(content.parse()?);
}
- if has_visibility || is_const_impl || is_impl_for && trait_.is_none() {
+ if is_const_impl || is_impl_for && trait_.is_none() {
Ok(None)
} else {
Ok(Some(ItemImpl {
- attrs,
+ attrs: private::attrs(outer_attrs, inner_attrs),
defaultness,
unsafety,
impl_token,
@@ -2559,6 +2598,8 @@ pub mod parsing {
}
} else if lookahead.peek(Token![type]) {
parse_impl_item_type(begin, input)
+ } else if vis.is_inherited() && defaultness.is_none() && lookahead.peek(existential) {
+ input.call(item_existential).map(ImplItem::Verbatim)
} else if vis.is_inherited()
&& defaultness.is_none()
&& (lookahead.peek(Ident)
@@ -2585,7 +2626,7 @@ pub mod parsing {
#[cfg(not(test))]
_ => unreachable!(),
};
- attrs.append(item_attrs);
+ attrs.extend(item_attrs.drain(..));
*item_attrs = attrs;
}
@@ -2635,7 +2676,7 @@ pub mod parsing {
punct.set_span(semi.span);
let tokens = TokenStream::from_iter(vec![TokenTree::Punct(punct)]);
Block {
- brace_token: Brace { span: semi.span },
+ brace_token: Brace::default(),
stmts: vec![Stmt::Item(Item::Verbatim(tokens))],
}
} else {
diff --git a/src/lib.rs b/src/lib.rs
index b3efd15b..ea0c6dde 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -250,26 +250,21 @@
//! dynamic library libproc_macro from rustc toolchain.
// Syn types in rustdoc of other crates get linked to here.
-#![doc(html_root_url = "https://docs.rs/syn/1.0.86")]
+#![doc(html_root_url = "https://docs.rs/syn/1.0.69")]
#![cfg_attr(doc_cfg, feature(doc_cfg))]
#![allow(non_camel_case_types)]
// Ignored clippy lints.
#![allow(
- clippy::cast_lossless,
- clippy::collapsible_match, // https://github.com/rust-lang/rust-clippy/issues/7575
clippy::doc_markdown,
clippy::eval_order_dependence,
clippy::inherent_to_string,
clippy::large_enum_variant,
- clippy::let_underscore_drop,
- clippy::manual_assert,
clippy::manual_map, // https://github.com/rust-lang/rust-clippy/issues/6795
clippy::match_on_vec_items,
clippy::missing_panics_doc,
clippy::needless_doctest_main,
clippy::needless_pass_by_value,
clippy::never_loop,
- clippy::return_self_not_must_use,
clippy::too_many_arguments,
clippy::trivially_copy_pass_by_ref,
clippy::unnecessary_unwrap,
@@ -279,14 +274,10 @@
// Ignored clippy_pedantic lints.
#![allow(
clippy::cast_possible_truncation,
- // clippy bug: https://github.com/rust-lang/rust-clippy/issues/7127
- clippy::cloned_instead_of_copied,
clippy::default_trait_access,
clippy::empty_enum,
clippy::expl_impl_clone_on_copy,
clippy::if_not_else,
- // clippy bug: https://github.com/rust-lang/rust-clippy/issues/8285
- clippy::iter_not_returning_iterator,
clippy::match_same_arms,
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/6984
clippy::match_wildcard_for_single_variants,
@@ -829,7 +820,6 @@ mod verbatim;
#[cfg(all(any(feature = "full", feature = "derive"), feature = "printing"))]
mod print;
-#[cfg(any(feature = "full", feature = "derive"))]
use crate::__private::private;
////////////////////////////////////////////////////////////////////////////////
@@ -898,9 +888,6 @@ pub fn parse<T: parse::Parse>(tokens: proc_macro::TokenStream) -> Result<T> {
/// Parse a proc-macro2 token stream into the chosen syntax tree node.
///
-/// This function will check that the input is fully parsed. If there are
-/// any unparsed tokens at the end of the stream, an error is returned.
-///
/// This function parses a `proc_macro2::TokenStream` which is commonly useful
/// when the input comes from a node of the Syn syntax tree, for example the
/// body tokens of a [`Macro`] node. When in a procedural macro parsing the
diff --git a/src/lifetime.rs b/src/lifetime.rs
index 5dc1753a..28cd7e36 100644
--- a/src/lifetime.rs
+++ b/src/lifetime.rs
@@ -108,7 +108,7 @@ impl Ord for Lifetime {
impl Hash for Lifetime {
fn hash<H: Hasher>(&self, h: &mut H) {
- self.ident.hash(h);
+ self.ident.hash(h)
}
}
diff --git a/src/lit.rs b/src/lit.rs
index bb61ee26..0aa50a59 100644
--- a/src/lit.rs
+++ b/src/lit.rs
@@ -3,9 +3,12 @@ use crate::lookahead;
#[cfg(feature = "parsing")]
use crate::parse::{Parse, Parser};
use crate::{Error, Result};
-use proc_macro2::{Ident, Literal, Span};
+#[cfg(feature = "printing")]
+use proc_macro2::Ident;
#[cfg(feature = "parsing")]
-use proc_macro2::{TokenStream, TokenTree};
+use proc_macro2::TokenStream;
+use proc_macro2::TokenTree;
+use proc_macro2::{Literal, Span};
use std::fmt::{self, Display};
#[cfg(feature = "extra-traits")]
use std::hash::{Hash, Hasher};
@@ -37,7 +40,7 @@ ast_enum_of_structs! {
/// A floating point literal: `1f64` or `1.0e10f64`.
///
- /// Must be finite. May not be infinite or NaN.
+ /// Must be finite. May not be infinte or NaN.
Float(LitFloat),
/// A boolean literal: `true` or `false`.
@@ -235,16 +238,12 @@ impl LitStr {
}
pub fn set_span(&mut self, span: Span) {
- self.repr.token.set_span(span);
+ self.repr.token.set_span(span)
}
pub fn suffix(&self) -> &str {
&self.repr.suffix
}
-
- pub fn token(&self) -> Literal {
- self.repr.token.clone()
- }
}
impl LitByteStr {
@@ -270,16 +269,12 @@ impl LitByteStr {
}
pub fn set_span(&mut self, span: Span) {
- self.repr.token.set_span(span);
+ self.repr.token.set_span(span)
}
pub fn suffix(&self) -> &str {
&self.repr.suffix
}
-
- pub fn token(&self) -> Literal {
- self.repr.token.clone()
- }
}
impl LitByte {
@@ -305,16 +300,12 @@ impl LitByte {
}
pub fn set_span(&mut self, span: Span) {
- self.repr.token.set_span(span);
+ self.repr.token.set_span(span)
}
pub fn suffix(&self) -> &str {
&self.repr.suffix
}
-
- pub fn token(&self) -> Literal {
- self.repr.token.clone()
- }
}
impl LitChar {
@@ -340,16 +331,12 @@ impl LitChar {
}
pub fn set_span(&mut self, span: Span) {
- self.repr.token.set_span(span);
+ self.repr.token.set_span(span)
}
pub fn suffix(&self) -> &str {
&self.repr.suffix
}
-
- pub fn token(&self) -> Literal {
- self.repr.token.clone()
- }
}
impl LitInt {
@@ -419,11 +406,7 @@ impl LitInt {
}
pub fn set_span(&mut self, span: Span) {
- self.repr.token.set_span(span);
- }
-
- pub fn token(&self) -> Literal {
- self.repr.token.clone()
+ self.repr.token.set_span(span)
}
}
@@ -495,11 +478,7 @@ impl LitFloat {
}
pub fn set_span(&mut self, span: Span) {
- self.repr.token.set_span(span);
- }
-
- pub fn token(&self) -> Literal {
- self.repr.token.clone()
+ self.repr.token.set_span(span)
}
}
@@ -542,11 +521,6 @@ impl LitBool {
pub fn set_span(&mut self, span: Span) {
self.span = span;
}
-
- pub fn token(&self) -> Ident {
- let s = if self.value { "true" } else { "false" };
- Ident::new(s, self.span)
- }
}
#[cfg(feature = "extra-traits")]
@@ -942,7 +916,8 @@ mod printing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))]
impl ToTokens for LitBool {
fn to_tokens(&self, tokens: &mut TokenStream) {
- tokens.append(self.token());
+ let s = if self.value { "true" } else { "false" };
+ tokens.append(Ident::new(s, self.span));
}
}
}
@@ -950,6 +925,7 @@ mod printing {
mod value {
use super::*;
use crate::bigint::BigInt;
+ use proc_macro2::TokenStream;
use std::char;
use std::ops::{Index, RangeFrom};
@@ -1461,7 +1437,7 @@ mod value {
}
let suffix = s;
- if suffix.is_empty() || crate::ident::xid_ok(suffix) {
+ if suffix.is_empty() || crate::ident::xid_ok(&suffix) {
let mut repr = value.to_string();
if negative {
repr.insert(0, '-');
@@ -1564,37 +1540,35 @@ mod value {
}
}
- #[allow(clippy::unnecessary_wraps)]
pub fn to_literal(repr: &str, digits: &str, suffix: &str) -> Option<Literal> {
- #[cfg(syn_no_negative_literal_parse)]
- {
- // Rustc older than https://github.com/rust-lang/rust/pull/87262.
- if repr.starts_with('-') {
- let f64_parse_finite = || digits.parse().ok().filter(|x: &f64| x.is_finite());
- let f32_parse_finite = || digits.parse().ok().filter(|x: &f32| x.is_finite());
- return if suffix == "f64" {
- f64_parse_finite().map(Literal::f64_suffixed)
- } else if suffix == "f32" {
- f32_parse_finite().map(Literal::f32_suffixed)
- } else if suffix == "i64" {
- digits.parse().ok().map(Literal::i64_suffixed)
- } else if suffix == "i32" {
- digits.parse().ok().map(Literal::i32_suffixed)
- } else if suffix == "i16" {
- digits.parse().ok().map(Literal::i16_suffixed)
- } else if suffix == "i8" {
- digits.parse().ok().map(Literal::i8_suffixed)
- } else if !suffix.is_empty() {
- None
- } else if digits.contains('.') {
- f64_parse_finite().map(Literal::f64_unsuffixed)
- } else {
- digits.parse().ok().map(Literal::i64_unsuffixed)
- };
+ if repr.starts_with('-') {
+ let f64_parse_finite = || digits.parse().ok().filter(|x: &f64| x.is_finite());
+ let f32_parse_finite = || digits.parse().ok().filter(|x: &f32| x.is_finite());
+ if suffix == "f64" {
+ f64_parse_finite().map(Literal::f64_suffixed)
+ } else if suffix == "f32" {
+ f32_parse_finite().map(Literal::f32_suffixed)
+ } else if suffix == "i64" {
+ digits.parse().ok().map(Literal::i64_suffixed)
+ } else if suffix == "i32" {
+ digits.parse().ok().map(Literal::i32_suffixed)
+ } else if suffix == "i16" {
+ digits.parse().ok().map(Literal::i16_suffixed)
+ } else if suffix == "i8" {
+ digits.parse().ok().map(Literal::i8_suffixed)
+ } else if !suffix.is_empty() {
+ None
+ } else if digits.contains('.') {
+ f64_parse_finite().map(Literal::f64_unsuffixed)
+ } else {
+ digits.parse().ok().map(Literal::i64_unsuffixed)
+ }
+ } else {
+ let stream = repr.parse::<TokenStream>().unwrap();
+ match stream.into_iter().next().unwrap() {
+ TokenTree::Literal(l) => Some(l),
+ _ => unreachable!(),
}
}
- let _ = digits;
- let _ = suffix;
- Some(repr.parse::<Literal>().unwrap())
}
}
diff --git a/src/parse_quote.rs b/src/parse_quote.rs
index 8deae4e5..ec551ef9 100644
--- a/src/parse_quote.rs
+++ b/src/parse_quote.rs
@@ -58,6 +58,7 @@
/// `P` with optional trailing punctuation
/// - [`Vec<Stmt>`] — parses the same as `Block::parse_within`
///
+/// [`Punctuated<T, P>`]: crate::punctuated::Punctuated
/// [`Vec<Stmt>`]: Block::parse_within
///
/// # Panics
@@ -65,43 +66,18 @@
/// Panics if the tokens fail to parse as the expected syntax tree type. The
/// caller is responsible for ensuring that the input tokens are syntactically
/// valid.
+//
+// TODO: allow Punctuated to be inferred as intra doc link, currently blocked on
+// https://github.com/rust-lang/rust/issues/62834
#[cfg_attr(doc_cfg, doc(cfg(all(feature = "parsing", feature = "printing"))))]
#[macro_export]
macro_rules! parse_quote {
($($tt:tt)*) => {
- $crate::parse_quote::parse($crate::__private::quote::quote!($($tt)*))
- };
-}
-
-/// This macro is [`parse_quote!`] + [`quote_spanned!`][quote::quote_spanned].
-///
-/// Please refer to each of their documentation.
-///
-/// # Example
-///
-/// ```
-/// use quote::{quote, quote_spanned};
-/// use syn::spanned::Spanned;
-/// use syn::{parse_quote_spanned, ReturnType, Signature};
-///
-/// // Changes `fn()` to `fn() -> Pin<Box<dyn Future<Output = ()>>>`,
-/// // and `fn() -> T` to `fn() -> Pin<Box<dyn Future<Output = T>>>`,
-/// // without introducing any call_site() spans.
-/// fn make_ret_pinned_future(sig: &mut Signature) {
-/// let ret = match &sig.output {
-/// ReturnType::Default => quote_spanned!(sig.paren_token.span=> ()),
-/// ReturnType::Type(_, ret) => quote!(#ret),
-/// };
-/// sig.output = parse_quote_spanned! {ret.span()=>
-/// -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = #ret>>>
-/// };
-/// }
-/// ```
-#[cfg_attr(doc_cfg, doc(cfg(all(feature = "parsing", feature = "printing"))))]
-#[macro_export]
-macro_rules! parse_quote_spanned {
- ($span:expr=> $($tt:tt)*) => {
- $crate::parse_quote::parse($crate::__private::quote::quote_spanned!($span=> $($tt)*))
+ $crate::parse_quote::parse(
+ $crate::__private::From::from(
+ $crate::__private::quote::quote!($($tt)*)
+ )
+ )
};
}
diff --git a/src/pat.rs b/src/pat.rs
index bfabfe66..d25843fc 100644
--- a/src/pat.rs
+++ b/src/pat.rs
@@ -376,7 +376,19 @@ pub mod parsing {
let begin = input.fork();
let (qself, path) = path::parsing::qpath(input, true)?;
- if qself.is_none() && input.peek(Token![!]) && !input.peek(Token![!=]) {
+ if input.peek(Token![..]) {
+ return pat_range(input, begin, qself, path);
+ }
+
+ if qself.is_some() {
+ return Ok(Pat::Path(PatPath {
+ attrs: Vec::new(),
+ qself,
+ path,
+ }));
+ }
+
+ if input.peek(Token![!]) && !input.peek(Token![!=]) {
let mut contains_arguments = false;
for segment in &path.segments {
match segment.arguments {
@@ -403,19 +415,9 @@ pub mod parsing {
}
if input.peek(token::Brace) {
- let pat = pat_struct(input, path)?;
- if qself.is_some() {
- Ok(Pat::Verbatim(verbatim::between(begin, input)))
- } else {
- Ok(Pat::Struct(pat))
- }
+ pat_struct(input, path).map(Pat::Struct)
} else if input.peek(token::Paren) {
- let pat = pat_tuple_struct(input, path)?;
- if qself.is_some() {
- Ok(Pat::Verbatim(verbatim::between(begin, input)))
- } else {
- Ok(Pat::TupleStruct(pat))
- }
+ pat_tuple_struct(input, path).map(Pat::TupleStruct)
} else if input.peek(Token![..]) {
pat_range(input, begin, qself, path)
} else {
diff --git a/src/path.rs b/src/path.rs
index 48673177..df1788db 100644
--- a/src/path.rs
+++ b/src/path.rs
@@ -292,18 +292,6 @@ pub mod parsing {
return Ok(Expr::Lit(lit));
}
- #[cfg(feature = "full")]
- {
- if input.peek(Ident) {
- let ident: Ident = input.parse()?;
- return Ok(Expr::Path(ExprPath {
- attrs: Vec::new(),
- qself: None,
- path: Path::from(ident),
- }));
- }
- }
-
if input.peek(token::Brace) {
#[cfg(feature = "full")]
{
@@ -589,7 +577,7 @@ pub mod parsing {
path: &mut Self,
expr_style: bool,
) -> Result<()> {
- while input.peek(Token![::]) && !input.peek3(token::Paren) {
+ while input.peek(Token![::]) {
let punct: Token![::] = input.parse()?;
path.segments.push_punct(punct);
let value = PathSegment::parse_helper(input, expr_style)?;
diff --git a/src/punctuated.rs b/src/punctuated.rs
index 5e9a34bd..f94edc29 100644
--- a/src/punctuated.rs
+++ b/src/punctuated.rs
@@ -193,7 +193,7 @@ impl<T, P> Punctuated<T, P> {
if self.last.is_some() {
self.last.take().map(|t| Pair::End(*t))
} else {
- self.inner.pop().map(|(t, p)| Pair::Punctuated(t, p))
+ self.inner.pop().map(|(t, d)| Pair::Punctuated(t, d))
}
}
@@ -937,16 +937,16 @@ impl<T, P> Pair<T, P> {
/// the final one and there is no trailing punctuation.
pub fn punct(&self) -> Option<&P> {
match self {
- Pair::Punctuated(_, p) => Some(p),
+ Pair::Punctuated(_, d) => Some(d),
Pair::End(_) => None,
}
}
/// Creates a punctuated pair out of a syntax tree node and an optional
/// following punctuation.
- pub fn new(t: T, p: Option<P>) -> Self {
- match p {
- Some(p) => Pair::Punctuated(t, p),
+ pub fn new(t: T, d: Option<P>) -> Self {
+ match d {
+ Some(d) => Pair::Punctuated(t, d),
None => Pair::End(t),
}
}
@@ -955,7 +955,7 @@ impl<T, P> Pair<T, P> {
/// optional following punctuation.
pub fn into_tuple(self) -> (T, Option<P>) {
match self {
- Pair::Punctuated(t, p) => (t, Some(p)),
+ Pair::Punctuated(t, d) => (t, Some(d)),
Pair::End(t) => (t, None),
}
}
@@ -1017,7 +1017,7 @@ mod printing {
P: ToTokens,
{
fn to_tokens(&self, tokens: &mut TokenStream) {
- tokens.append_all(self.pairs());
+ tokens.append_all(self.pairs())
}
}
diff --git a/src/stmt.rs b/src/stmt.rs
index 3e2c71bd..ba2b22e5 100644
--- a/src/stmt.rs
+++ b/src/stmt.rs
@@ -50,7 +50,7 @@ ast_struct! {
pub mod parsing {
use super::*;
use crate::parse::discouraged::Speculative;
- use crate::parse::{Parse, ParseBuffer, ParseStream, Result};
+ use crate::parse::{Parse, ParseStream, Result};
use proc_macro2::TokenStream;
impl Block {
@@ -152,25 +152,20 @@ pub mod parsing {
}
fn parse_stmt(input: ParseStream, allow_nosemi: bool) -> Result<Stmt> {
- let begin = input.fork();
let mut attrs = input.call(Attribute::parse_outer)?;
// brace-style macros; paren and bracket macros get parsed as
// expression statements.
let ahead = input.fork();
if let Ok(path) = ahead.call(Path::parse_mod_style) {
- if ahead.peek(Token![!])
- && (ahead.peek2(token::Brace)
- && !(ahead.peek3(Token![.]) || ahead.peek3(Token![?]))
- || ahead.peek2(Ident))
- {
+ if ahead.peek(Token![!]) && (ahead.peek2(token::Brace) || ahead.peek2(Ident)) {
input.advance_to(&ahead);
return stmt_mac(input, attrs, path);
}
}
if input.peek(Token![let]) {
- stmt_local(input, attrs, begin)
+ stmt_local(input, attrs).map(Stmt::Local)
} else if input.peek(Token![pub])
|| input.peek(Token![crate]) && !input.peek2(Token![::])
|| input.peek(Token![extern])
@@ -185,6 +180,7 @@ pub mod parsing {
|| input.peek(Token![fn])
|| input.peek(Token![mod])
|| input.peek(Token![type])
+ || input.peek(item::parsing::existential) && input.peek2(Token![type])
|| input.peek(Token![struct])
|| input.peek(Token![enum])
|| input.peek(Token![union]) && input.peek2(Ident)
@@ -223,49 +219,35 @@ pub mod parsing {
})))
}
- fn stmt_local(input: ParseStream, attrs: Vec<Attribute>, begin: ParseBuffer) -> Result<Stmt> {
- let let_token: Token![let] = input.parse()?;
-
- let mut pat: Pat = pat::parsing::multi_pat_with_leading_vert(input)?;
- if input.peek(Token![:]) {
- let colon_token: Token![:] = input.parse()?;
- let ty: Type = input.parse()?;
- pat = Pat::Type(PatType {
- attrs: Vec::new(),
- pat: Box::new(pat),
- colon_token,
- ty: Box::new(ty),
- });
- }
-
- let init = if input.peek(Token![=]) {
- let eq_token: Token![=] = input.parse()?;
- let init: Expr = input.parse()?;
-
- if input.peek(Token![else]) {
- input.parse::<Token![else]>()?;
- let content;
- braced!(content in input);
- content.call(Block::parse_within)?;
- let verbatim = Expr::Verbatim(verbatim::between(begin, input));
- let semi_token: Token![;] = input.parse()?;
- return Ok(Stmt::Semi(verbatim, semi_token));
- }
-
- Some((eq_token, Box::new(init)))
- } else {
- None
- };
-
- let semi_token: Token![;] = input.parse()?;
-
- Ok(Stmt::Local(Local {
+ fn stmt_local(input: ParseStream, attrs: Vec<Attribute>) -> Result<Local> {
+ Ok(Local {
attrs,
- let_token,
- pat,
- init,
- semi_token,
- }))
+ let_token: input.parse()?,
+ pat: {
+ let mut pat: Pat = pat::parsing::multi_pat_with_leading_vert(input)?;
+ if input.peek(Token![:]) {
+ let colon_token: Token![:] = input.parse()?;
+ let ty: Type = input.parse()?;
+ pat = Pat::Type(PatType {
+ attrs: Vec::new(),
+ pat: Box::new(pat),
+ colon_token,
+ ty: Box::new(ty),
+ });
+ }
+ pat
+ },
+ init: {
+ if input.peek(Token![=]) {
+ let eq_token: Token![=] = input.parse()?;
+ let init: Expr = input.parse()?;
+ Some((eq_token, Box::new(init)))
+ } else {
+ None
+ }
+ },
+ semi_token: input.parse()?,
+ })
}
fn stmt_expr(
@@ -276,13 +258,8 @@ pub mod parsing {
let mut e = expr::parsing::expr_early(input)?;
let mut attr_target = &mut e;
- loop {
- attr_target = match attr_target {
- Expr::Assign(e) => &mut e.left,
- Expr::AssignOp(e) => &mut e.left,
- Expr::Binary(e) => &mut e.left,
- _ => break,
- };
+ while let Expr::Binary(e) = attr_target {
+ attr_target = &mut e.left;
}
attrs.extend(attr_target.replace_attrs(Vec::new()));
attr_target.replace_attrs(attrs);
diff --git a/src/ty.rs b/src/ty.rs
index c38200f9..b60109f9 100644
--- a/src/ty.rs
+++ b/src/ty.rs
@@ -341,6 +341,7 @@ pub mod parsing {
use crate::parse::{Parse, ParseStream, Result};
use crate::path;
use proc_macro2::{Punct, Spacing, TokenTree};
+ use std::iter::FromIterator;
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for Type {
@@ -412,7 +413,6 @@ pub mod parsing {
&& !lookahead.peek(Token![self])
&& !lookahead.peek(Token![Self])
&& !lookahead.peek(Token![crate])
- || input.peek(Token![dyn])
{
return Err(lookahead.error());
}
@@ -541,7 +541,15 @@ pub mod parsing {
|| lookahead.peek(Token![<])
{
if input.peek(Token![dyn]) {
- let trait_object = TypeTraitObject::parse(input, allow_plus)?;
+ let mut trait_object: TypeTraitObject = input.parse()?;
+ if lifetimes.is_some() {
+ match trait_object.bounds.iter_mut().next().unwrap() {
+ TypeParamBound::Trait(trait_bound) => {
+ trait_bound.lifetimes = lifetimes;
+ }
+ TypeParamBound::Lifetime(_) => unreachable!(),
+ }
+ }
return Ok(Type::TraitObject(trait_object));
}
@@ -586,12 +594,7 @@ pub mod parsing {
if allow_plus {
while input.peek(Token![+]) {
bounds.push_punct(input.parse()?);
- if !(input.peek(Ident::peek_any)
- || input.peek(Token![::])
- || input.peek(Token![?])
- || input.peek(Lifetime)
- || input.peek(token::Paren))
- {
+ if input.peek(Token![>]) {
break;
}
bounds.push_value(input.parse()?);
@@ -628,7 +631,7 @@ pub mod parsing {
} else if lookahead.peek(Token![!]) && !input.peek(Token![=]) {
input.parse().map(Type::Never)
} else if lookahead.peek(Token![impl]) {
- TypeImplTrait::parse(input, allow_plus).map(Type::ImplTrait)
+ input.parse().map(Type::ImplTrait)
} else if lookahead.peek(Token![_]) {
input.parse().map(Type::Infer)
} else if lookahead.peek(Lifetime) {
@@ -821,10 +824,7 @@ pub mod parsing {
fn parse(input: ParseStream) -> Result<Self> {
let (qself, mut path) = path::parsing::qpath(input, false)?;
- if path.segments.last().unwrap().arguments.is_empty()
- && (input.peek(token::Paren) || input.peek(Token![::]) && input.peek3(token::Paren))
- {
- input.parse::<Option<Token![::]>>()?;
+ if path.segments.last().unwrap().arguments.is_empty() && input.peek(token::Paren) {
let args: ParenthesizedGenericArguments = input.parse()?;
let parenthesized = PathArguments::Parenthesized(args);
path.segments.last_mut().unwrap().arguments = parenthesized;
@@ -835,13 +835,13 @@ pub mod parsing {
}
impl ReturnType {
- #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
pub fn without_plus(input: ParseStream) -> Result<Self> {
let allow_plus = false;
Self::parse(input, allow_plus)
}
- pub(crate) fn parse(input: ParseStream, allow_plus: bool) -> Result<Self> {
+ #[doc(hidden)]
+ pub fn parse(input: ParseStream, allow_plus: bool) -> Result<Self> {
if input.peek(Token![->]) {
let arrow = input.parse()?;
let ty = ambig_ty(input, allow_plus)?;
@@ -855,16 +855,14 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ReturnType {
fn parse(input: ParseStream) -> Result<Self> {
- let allow_plus = true;
- Self::parse(input, allow_plus)
+ Self::parse(input, true)
}
}
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for TypeTraitObject {
fn parse(input: ParseStream) -> Result<Self> {
- let allow_plus = true;
- Self::parse(input, allow_plus)
+ Self::parse(input, true)
}
}
@@ -878,67 +876,60 @@ pub mod parsing {
}
impl TypeTraitObject {
- #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
pub fn without_plus(input: ParseStream) -> Result<Self> {
let allow_plus = false;
Self::parse(input, allow_plus)
}
// Only allow multiple trait references if allow_plus is true.
- pub(crate) fn parse(input: ParseStream, allow_plus: bool) -> Result<Self> {
+ #[doc(hidden)]
+ pub fn parse(input: ParseStream, allow_plus: bool) -> Result<Self> {
Ok(TypeTraitObject {
dyn_token: input.parse()?,
- bounds: Self::parse_bounds(input, allow_plus)?,
+ bounds: {
+ let mut bounds = Punctuated::new();
+ if allow_plus {
+ loop {
+ bounds.push_value(input.parse()?);
+ if !input.peek(Token![+]) {
+ break;
+ }
+ bounds.push_punct(input.parse()?);
+ if input.peek(Token![>]) {
+ break;
+ }
+ }
+ } else {
+ bounds.push_value(input.parse()?);
+ }
+ // Just lifetimes like `'a + 'b` is not a TraitObject.
+ if !at_least_one_type(&bounds) {
+ return Err(input.error("expected at least one type"));
+ }
+ bounds
+ },
})
}
-
- fn parse_bounds(
- input: ParseStream,
- allow_plus: bool,
- ) -> Result<Punctuated<TypeParamBound, Token![+]>> {
- let mut bounds = Punctuated::new();
- loop {
- bounds.push_value(input.parse()?);
- if !(allow_plus && input.peek(Token![+])) {
- break;
- }
- bounds.push_punct(input.parse()?);
- if !(input.peek(Ident::peek_any)
- || input.peek(Token![::])
- || input.peek(Token![?])
- || input.peek(Lifetime)
- || input.peek(token::Paren))
- {
- break;
- }
- }
- // Just lifetimes like `'a + 'b` is not a TraitObject.
- if !at_least_one_type(&bounds) {
- return Err(input.error("expected at least one type"));
- }
- Ok(bounds)
- }
}
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for TypeImplTrait {
fn parse(input: ParseStream) -> Result<Self> {
- let allow_plus = true;
- Self::parse(input, allow_plus)
- }
- }
-
- impl TypeImplTrait {
- #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
- pub fn without_plus(input: ParseStream) -> Result<Self> {
- let allow_plus = false;
- Self::parse(input, allow_plus)
- }
-
- pub(crate) fn parse(input: ParseStream, allow_plus: bool) -> Result<Self> {
Ok(TypeImplTrait {
impl_token: input.parse()?,
- bounds: TypeTraitObject::parse_bounds(input, allow_plus)?,
+ // NOTE: rust-lang/rust#34511 includes discussion about whether
+ // or not + should be allowed in ImplTrait directly without ().
+ bounds: {
+ let mut bounds = Punctuated::new();
+ loop {
+ bounds.push_value(input.parse()?);
+ if !input.peek(Token![+]) {
+ break;
+ }
+ bounds.push_punct(input.parse()?);
+ }
+ bounds
+ },
})
}
}
@@ -1018,14 +1009,12 @@ pub mod parsing {
TokenTree::Punct(Punct::new('.', Spacing::Joint)),
TokenTree::Punct(Punct::new('.', Spacing::Alone)),
];
- let tokens: TokenStream = args
- .into_iter()
- .zip(&dot3.spans)
- .map(|(mut arg, span)| {
+ let tokens = TokenStream::from_iter(args.into_iter().zip(&dot3.spans).map(
+ |(mut arg, span)| {
arg.set_span(*span);
arg
- })
- .collect();
+ },
+ ));
Type::Verbatim(tokens)
} else if allow_mut_self && input.peek(Token![mut]) && input.peek2(Token![self]) {
has_mut_self = true;
diff --git a/tests/common/eq.rs b/tests/common/eq.rs
index 5e3dd443..944d5851 100644
--- a/tests/common/eq.rs
+++ b/tests/common/eq.rs
@@ -3,28 +3,26 @@ extern crate rustc_data_structures;
extern crate rustc_span;
use rustc_ast::ast::{
- AngleBracketedArg, AngleBracketedArgs, AnonConst, Arm, AssocConstraint, AssocConstraintKind,
- AssocItemKind, Async, AttrId, AttrItem, AttrKind, AttrStyle, Attribute, BareFnTy, BinOpKind,
- BindingMode, Block, BlockCheckMode, BorrowKind, CaptureBy, Const, Crate, CrateSugar,
- Defaultness, EnumDef, Expr, ExprField, ExprKind, Extern, FieldDef, FloatTy, Fn, FnDecl,
- FnHeader, FnRetTy, FnSig, ForeignItemKind, ForeignMod, GenericArg, GenericArgs, GenericBound,
- GenericParam, GenericParamKind, Generics, Impl, ImplPolarity, Inline, InlineAsm,
+ AngleBracketedArg, AngleBracketedArgs, AnonConst, Arm, AssocItemKind, AssocTyConstraint,
+ AssocTyConstraintKind, Async, AttrId, AttrItem, AttrKind, AttrStyle, Attribute, BareFnTy,
+ BinOpKind, BindingMode, Block, BlockCheckMode, BorrowKind, CaptureBy, Const, Crate, CrateSugar,
+ Defaultness, EnumDef, Expr, ExprField, ExprKind, Extern, FieldDef, FloatTy, FnDecl, FnHeader,
+ FnKind, FnRetTy, FnSig, ForeignItemKind, ForeignMod, GenericArg, GenericArgs, GenericBound,
+ GenericParam, GenericParamKind, Generics, GlobalAsm, ImplKind, ImplPolarity, Inline, InlineAsm,
InlineAsmOperand, InlineAsmOptions, InlineAsmRegOrRegClass, InlineAsmTemplatePiece, IntTy,
- IsAuto, Item, ItemKind, Label, Lifetime, Lit, LitFloatType, LitIntType, LitKind, Local,
- LocalKind, MacArgs, MacCall, MacCallStmt, MacDelimiter, MacStmtStyle, MacroDef, ModKind,
- Movability, MutTy, Mutability, NodeId, Param, ParenthesizedArgs, Pat, PatField, PatKind, Path,
- PathSegment, PolyTraitRef, QSelf, RangeEnd, RangeLimits, RangeSyntax, Stmt, StmtKind, StrLit,
- StrStyle, StructExpr, StructRest, Term, Trait, TraitBoundModifier, TraitObjectSyntax, TraitRef,
- Ty, TyAlias, TyKind, UintTy, UnOp, Unsafe, UnsafeSource, UseTree, UseTreeKind, Variant,
- VariantData, Visibility, VisibilityKind, WhereBoundPredicate, WhereClause, WhereEqPredicate,
- WherePredicate, WhereRegionPredicate,
+ IsAuto, Item, ItemKind, Label, Lifetime, Lit, LitFloatType, LitIntType, LitKind,
+ LlvmAsmDialect, LlvmInlineAsm, LlvmInlineAsmOutput, Local, MacArgs, MacCall, MacCallStmt,
+ MacDelimiter, MacStmtStyle, MacroDef, ModKind, Movability, MutTy, Mutability, NodeId, Param,
+ ParenthesizedArgs, Pat, PatField, PatKind, Path, PathSegment, PolyTraitRef, QSelf, RangeEnd,
+ RangeLimits, RangeSyntax, Stmt, StmtKind, StrLit, StrStyle, StructExpr, StructRest,
+ TraitBoundModifier, TraitKind, TraitObjectSyntax, TraitRef, Ty, TyAliasKind, TyKind, UintTy,
+ UnOp, Unsafe, UnsafeSource, UseTree, UseTreeKind, Variant, VariantData, Visibility,
+ VisibilityKind, WhereBoundPredicate, WhereClause, WhereEqPredicate, WherePredicate,
+ WhereRegionPredicate,
};
use rustc_ast::ptr::P;
use rustc_ast::token::{self, CommentKind, DelimToken, Nonterminal, Token, TokenKind};
-use rustc_ast::tokenstream::{
- AttrAnnotatedTokenStream, AttrAnnotatedTokenTree, AttributesData, DelimSpan, LazyTokenStream,
- Spacing, TokenStream, TokenTree,
-};
+use rustc_ast::tokenstream::{DelimSpan, LazyTokenStream, TokenStream, TokenTree};
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::thin_vec::ThinVec;
use rustc_span::source_map::Spanned;
@@ -35,7 +33,7 @@ pub trait SpanlessEq {
fn eq(&self, other: &Self) -> bool;
}
-impl<T: ?Sized + SpanlessEq> SpanlessEq for Box<T> {
+impl<T: SpanlessEq> SpanlessEq for Box<T> {
fn eq(&self, other: &Self) -> bool {
SpanlessEq::eq(&**self, &**other)
}
@@ -97,14 +95,6 @@ impl<A: SpanlessEq, B: SpanlessEq> SpanlessEq for (A, B) {
}
}
-impl<A: SpanlessEq, B: SpanlessEq, C: SpanlessEq> SpanlessEq for (A, B, C) {
- fn eq(&self, other: &Self) -> bool {
- SpanlessEq::eq(&self.0, &other.0)
- && SpanlessEq::eq(&self.1, &other.1)
- && SpanlessEq::eq(&self.2, &other.2)
- }
-}
-
macro_rules! spanless_eq_true {
($name:ty) => {
impl SpanlessEq for $name {
@@ -120,7 +110,6 @@ spanless_eq_true!(DelimSpan);
spanless_eq_true!(AttrId);
spanless_eq_true!(NodeId);
spanless_eq_true!(SyntaxContext);
-spanless_eq_true!(Spacing);
macro_rules! spanless_eq_partial_eq {
($name:ty) => {
@@ -295,32 +284,33 @@ macro_rules! spanless_eq_enum {
spanless_eq_struct!(AngleBracketedArgs; span args);
spanless_eq_struct!(AnonConst; id value);
spanless_eq_struct!(Arm; attrs pat guard body span id is_placeholder);
-spanless_eq_struct!(AssocConstraint; id ident gen_args kind span);
-spanless_eq_struct!(AttrAnnotatedTokenStream; 0);
+spanless_eq_struct!(AssocTyConstraint; id ident gen_args kind span);
spanless_eq_struct!(AttrItem; path args tokens);
spanless_eq_struct!(Attribute; kind id style span);
-spanless_eq_struct!(AttributesData; attrs tokens);
spanless_eq_struct!(BareFnTy; unsafety ext generic_params decl);
-spanless_eq_struct!(Block; stmts id rules span tokens could_be_bare_literal);
-spanless_eq_struct!(Crate; attrs items span id is_placeholder);
+spanless_eq_struct!(Block; stmts id rules span tokens);
+spanless_eq_struct!(Crate; attrs items span proc_macros);
spanless_eq_struct!(EnumDef; variants);
spanless_eq_struct!(Expr; id kind span attrs !tokens);
spanless_eq_struct!(ExprField; attrs id span ident expr is_shorthand is_placeholder);
spanless_eq_struct!(FieldDef; attrs id span vis ident ty is_placeholder);
spanless_eq_struct!(FnDecl; inputs output);
spanless_eq_struct!(FnHeader; constness asyncness unsafety ext);
-spanless_eq_struct!(Fn; defaultness generics sig body);
+spanless_eq_struct!(FnKind; 0 1 2 3);
spanless_eq_struct!(FnSig; header decl span);
spanless_eq_struct!(ForeignMod; unsafety abi items);
spanless_eq_struct!(GenericParam; id ident attrs bounds is_placeholder kind);
spanless_eq_struct!(Generics; params where_clause span);
-spanless_eq_struct!(Impl; defaultness unsafety generics constness polarity of_trait self_ty items);
-spanless_eq_struct!(InlineAsm; template template_strs operands clobber_abis options line_spans);
+spanless_eq_struct!(GlobalAsm; asm);
+spanless_eq_struct!(ImplKind; unsafety polarity defaultness constness generics of_trait self_ty items);
+spanless_eq_struct!(InlineAsm; template operands options line_spans);
spanless_eq_struct!(Item<K>; attrs id span vis ident kind !tokens);
spanless_eq_struct!(Label; ident);
spanless_eq_struct!(Lifetime; id ident);
spanless_eq_struct!(Lit; token kind span);
-spanless_eq_struct!(Local; pat ty kind id span attrs !tokens);
+spanless_eq_struct!(LlvmInlineAsm; asm asm_str_style outputs inputs clobbers volatile alignstack dialect);
+spanless_eq_struct!(LlvmInlineAsmOutput; constraint expr is_rw is_indirect);
+spanless_eq_struct!(Local; pat ty init id span attrs !tokens);
spanless_eq_struct!(MacCall; path args prior_type_ascription);
spanless_eq_struct!(MacCallStmt; mac style attrs tokens);
spanless_eq_struct!(MacroDef; body macro_rules);
@@ -334,12 +324,12 @@ spanless_eq_struct!(PolyTraitRef; bound_generic_params trait_ref span);
spanless_eq_struct!(QSelf; ty path_span position);
spanless_eq_struct!(Stmt; id kind span);
spanless_eq_struct!(StrLit; style symbol suffix span symbol_unescaped);
-spanless_eq_struct!(StructExpr; qself path fields rest);
+spanless_eq_struct!(StructExpr; path fields rest);
spanless_eq_struct!(Token; kind span);
-spanless_eq_struct!(Trait; unsafety is_auto generics bounds items);
+spanless_eq_struct!(TraitKind; 0 1 2 3 4);
spanless_eq_struct!(TraitRef; path ref_id);
spanless_eq_struct!(Ty; id kind span tokens);
-spanless_eq_struct!(TyAlias; defaultness generics bounds ty);
+spanless_eq_struct!(TyAliasKind; 0 1 2 3);
spanless_eq_struct!(UseTree; prefix kind span);
spanless_eq_struct!(Variant; attrs id span !vis ident data disr_expr is_placeholder);
spanless_eq_struct!(Visibility; kind span tokens);
@@ -350,9 +340,8 @@ spanless_eq_struct!(WhereRegionPredicate; span lifetime bounds);
spanless_eq_struct!(token::Lit; kind symbol suffix);
spanless_eq_enum!(AngleBracketedArg; Arg(0) Constraint(0));
spanless_eq_enum!(AssocItemKind; Const(0 1 2) Fn(0) TyAlias(0) MacCall(0));
-spanless_eq_enum!(AssocConstraintKind; Equality(term) Bound(bounds));
+spanless_eq_enum!(AssocTyConstraintKind; Equality(ty) Bound(bounds));
spanless_eq_enum!(Async; Yes(span closure_id return_impl_trait_id) No);
-spanless_eq_enum!(AttrAnnotatedTokenTree; Token(0) Delimited(0 1 2) Attributes(0));
spanless_eq_enum!(AttrStyle; Outer Inner);
spanless_eq_enum!(BinOpKind; Add Sub Mul Div Rem And Or BitXor BitAnd BitOr Shl Shr Eq Lt Le Ne Ge Gt);
spanless_eq_enum!(BindingMode; ByRef(0) ByValue(0));
@@ -378,7 +367,7 @@ spanless_eq_enum!(IntTy; Isize I8 I16 I32 I64 I128);
spanless_eq_enum!(IsAuto; Yes No);
spanless_eq_enum!(LitFloatType; Suffixed(0) Unsuffixed);
spanless_eq_enum!(LitIntType; Signed(0) Unsigned(0) Unsuffixed);
-spanless_eq_enum!(LocalKind; Decl Init(0) InitElse(0 1));
+spanless_eq_enum!(LlvmAsmDialect; Att Intel);
spanless_eq_enum!(MacArgs; Empty Delimited(0 1 2) Eq(0 1));
spanless_eq_enum!(MacDelimiter; Parenthesis Bracket Brace);
spanless_eq_enum!(MacStmtStyle; Semicolon Braces NoBraces);
@@ -390,7 +379,6 @@ spanless_eq_enum!(RangeLimits; HalfOpen Closed);
spanless_eq_enum!(StmtKind; Local(0) Item(0) Expr(0) Semi(0) Empty MacCall(0));
spanless_eq_enum!(StrStyle; Cooked Raw(0));
spanless_eq_enum!(StructRest; Base(0) Rest(0) None);
-spanless_eq_enum!(Term; Ty(0) Const(0));
spanless_eq_enum!(TokenTree; Token(0) Delimited(0 1 2));
spanless_eq_enum!(TraitBoundModifier; None Maybe MaybeConst MaybeConstMaybe);
spanless_eq_enum!(TraitObjectSyntax; Dyn None);
@@ -404,11 +392,12 @@ spanless_eq_enum!(VisibilityKind; Public Crate(0) Restricted(path id) Inherited)
spanless_eq_enum!(WherePredicate; BoundPredicate(0) RegionPredicate(0) EqPredicate(0));
spanless_eq_enum!(ExprKind; Box(0) Array(0) ConstBlock(0) Call(0 1)
MethodCall(0 1 2) Tup(0) Binary(0 1 2) Unary(0 1) Lit(0) Cast(0 1) Type(0 1)
- Let(0 1 2) If(0 1 2) While(0 1 2) ForLoop(0 1 2 3) Loop(0 1) Match(0 1)
+ Let(0 1) If(0 1 2) While(0 1 2) ForLoop(0 1 2 3) Loop(0 1) Match(0 1)
Closure(0 1 2 3 4 5) Block(0 1) Async(0 1 2) Await(0) TryBlock(0)
Assign(0 1 2) AssignOp(0 1 2) Field(0 1) Index(0 1) Underscore Range(0 1 2)
Path(0 1) AddrOf(0 1 2) Break(0 1) Continue(0) Ret(0) InlineAsm(0)
- MacCall(0) Struct(0) Repeat(0 1) Paren(0) Try(0) Yield(0) Err);
+ LlvmInlineAsm(0) MacCall(0) Struct(0) Repeat(0 1) Paren(0) Try(0) Yield(0)
+ Err);
spanless_eq_enum!(InlineAsmOperand; In(reg expr) Out(reg late expr)
InOut(reg late expr) SplitInOut(reg late in_expr out_expr) Const(anon_const)
Sym(expr));
@@ -417,7 +406,7 @@ spanless_eq_enum!(ItemKind; ExternCrate(0) Use(0) Static(0 1 2) Const(0 1 2)
Union(0 1) Trait(0) TraitAlias(0 1) Impl(0) MacCall(0) MacroDef(0));
spanless_eq_enum!(LitKind; Str(0 1) ByteStr(0) Byte(0) Char(0) Int(0 1)
Float(0 1) Bool(0) Err(0));
-spanless_eq_enum!(PatKind; Wild Ident(0 1 2) Struct(0 1 2 3) TupleStruct(0 1 2)
+spanless_eq_enum!(PatKind; Wild Ident(0 1 2) Struct(0 1 2) TupleStruct(0 1)
Or(0) Path(0 1) Tuple(0) Box(0) Ref(0 1) Lit(0) Range(0 1 2) Slice(0) Rest
Paren(0) MacCall(0));
spanless_eq_enum!(TyKind; Slice(0) Array(0 1) Ptr(0) Rptr(0 1) BareFn(0) Never
@@ -524,7 +513,7 @@ impl SpanlessEq for TokenStream {
}
}
-fn doc_comment(
+fn doc_comment<'a>(
style: AttrStyle,
unescaped: Symbol,
trees: &mut impl Iterator<Item = TokenTree>,
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index 2156530b..a1cc80a1 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -1,5 +1,4 @@
#![allow(dead_code)]
-#![allow(clippy::module_name_repetitions, clippy::shadow_unrelated)]
use rayon::ThreadPoolBuilder;
use std::env;
diff --git a/tests/debug/gen.rs b/tests/debug/gen.rs
index a49ee6c9..1eae327b 100644
--- a/tests/debug/gen.rs
+++ b/tests/debug/gen.rs
@@ -591,29 +591,29 @@ impl Debug for Lite<syn::Expr> {
if !_val.attrs.is_empty() {
formatter.field("attrs", Lite(&_val.attrs));
}
- if let Some(val) = &_val.movability {
+ if let Some(val) = &_val.asyncness {
#[derive(RefCast)]
#[repr(transparent)]
- struct Print(syn::token::Static);
+ struct Print(syn::token::Async);
impl Debug for Print {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("Some")?;
Ok(())
}
}
- formatter.field("movability", Print::ref_cast(val));
+ formatter.field("asyncness", Print::ref_cast(val));
}
- if let Some(val) = &_val.asyncness {
+ if let Some(val) = &_val.movability {
#[derive(RefCast)]
#[repr(transparent)]
- struct Print(syn::token::Async);
+ struct Print(syn::token::Static);
impl Debug for Print {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("Some")?;
Ok(())
}
}
- formatter.field("asyncness", Print::ref_cast(val));
+ formatter.field("movability", Print::ref_cast(val));
}
if let Some(val) = &_val.capture {
#[derive(RefCast)]
@@ -1294,29 +1294,29 @@ impl Debug for Lite<syn::ExprClosure> {
if !_val.attrs.is_empty() {
formatter.field("attrs", Lite(&_val.attrs));
}
- if let Some(val) = &_val.movability {
+ if let Some(val) = &_val.asyncness {
#[derive(RefCast)]
#[repr(transparent)]
- struct Print(syn::token::Static);
+ struct Print(syn::token::Async);
impl Debug for Print {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("Some")?;
Ok(())
}
}
- formatter.field("movability", Print::ref_cast(val));
+ formatter.field("asyncness", Print::ref_cast(val));
}
- if let Some(val) = &_val.asyncness {
+ if let Some(val) = &_val.movability {
#[derive(RefCast)]
#[repr(transparent)]
- struct Print(syn::token::Async);
+ struct Print(syn::token::Static);
impl Debug for Print {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("Some")?;
Ok(())
}
}
- formatter.field("asyncness", Print::ref_cast(val));
+ formatter.field("movability", Print::ref_cast(val));
}
if let Some(val) = &_val.capture {
#[derive(RefCast)]
@@ -2672,7 +2672,8 @@ impl Debug for Lite<syn::Item> {
fn fmt(
&self,
formatter: &mut fmt::Formatter,
- ) -> fmt::Result {
+ ) -> fmt::Result
+ {
match &self.0 {
Some(_val) => {
formatter.write_str("Some")?;
@@ -3081,10 +3082,7 @@ impl Debug for Lite<syn::ItemImpl> {
#[repr(transparent)]
struct Print(Option<syn::token::Bang>);
impl Debug for Print {
- fn fmt(
- &self,
- formatter: &mut fmt::Formatter,
- ) -> fmt::Result {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
match &self.0 {
Some(_val) => {
formatter.write_str("Some")?;
@@ -3426,12 +3424,24 @@ impl Debug for Lite<syn::Lit> {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
let _val = &self.value;
match _val {
- syn::Lit::Str(_val) => write!(formatter, "{:?}", _val.value()),
- syn::Lit::ByteStr(_val) => write!(formatter, "{:?}", _val.value()),
- syn::Lit::Byte(_val) => write!(formatter, "{:?}", _val.value()),
- syn::Lit::Char(_val) => write!(formatter, "{:?}", _val.value()),
- syn::Lit::Int(_val) => write!(formatter, "{}", _val),
- syn::Lit::Float(_val) => write!(formatter, "{}", _val),
+ syn::Lit::Str(_val) => {
+ write!(formatter, "{:?}", _val.value())
+ }
+ syn::Lit::ByteStr(_val) => {
+ write!(formatter, "{:?}", _val.value())
+ }
+ syn::Lit::Byte(_val) => {
+ write!(formatter, "{:?}", _val.value())
+ }
+ syn::Lit::Char(_val) => {
+ write!(formatter, "{:?}", _val.value())
+ }
+ syn::Lit::Int(_val) => {
+ write!(formatter, "{}", _val)
+ }
+ syn::Lit::Float(_val) => {
+ write!(formatter, "{}", _val)
+ }
syn::Lit::Bool(_val) => {
let mut formatter = formatter.debug_struct("Lit::Bool");
formatter.field("value", Lite(&_val.value));
@@ -4192,8 +4202,7 @@ impl Debug for Lite<syn::PathArguments> {
match _val {
syn::PathArguments::None => formatter.write_str("None"),
syn::PathArguments::AngleBracketed(_val) => {
- let mut formatter = formatter
- .debug_struct("PathArguments::AngleBracketed");
+ let mut formatter = formatter.debug_struct("PathArguments::AngleBracketed");
if let Some(val) = &_val.colon2_token {
#[derive(RefCast)]
#[repr(transparent)]
@@ -4212,8 +4221,7 @@ impl Debug for Lite<syn::PathArguments> {
formatter.finish()
}
syn::PathArguments::Parenthesized(_val) => {
- let mut formatter = formatter
- .debug_struct("PathArguments::Parenthesized");
+ let mut formatter = formatter.debug_struct("PathArguments::Parenthesized");
if !_val.inputs.is_empty() {
formatter.field("inputs", Lite(&_val.inputs));
}
@@ -4337,10 +4345,7 @@ impl Debug for Lite<syn::Receiver> {
#[repr(transparent)]
struct Print(Option<syn::Lifetime>);
impl Debug for Print {
- fn fmt(
- &self,
- formatter: &mut fmt::Formatter,
- ) -> fmt::Result {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
match &self.0 {
Some(_val) => {
formatter.write_str("Some")?;
diff --git a/tests/debug/mod.rs b/tests/debug/mod.rs
index 05de6126..cefebace 100644
--- a/tests/debug/mod.rs
+++ b/tests/debug/mod.rs
@@ -1,10 +1,3 @@
-#![allow(
- clippy::no_effect_underscore_binding,
- clippy::too_many_lines,
- clippy::used_underscore_binding
-)]
-
-#[rustfmt::skip]
mod gen;
use proc_macro2::{Ident, Literal, TokenStream};
diff --git a/tests/macros/mod.rs b/tests/macros/mod.rs
index 86cdb5f6..db90818e 100644
--- a/tests/macros/mod.rs
+++ b/tests/macros/mod.rs
@@ -39,24 +39,18 @@ macro_rules! snapshot_impl {
(($expr:ident) as $t:ty, @$snapshot:literal) => {
let $expr = crate::macros::Tokens::parse::<$t>($expr).unwrap();
let debug = crate::macros::debug::Lite(&$expr);
- if !cfg!(miri) {
- insta::assert_debug_snapshot!(debug, @$snapshot);
- }
+ insta::assert_debug_snapshot!(debug, @$snapshot);
};
(($($expr:tt)*) as $t:ty, @$snapshot:literal) => {{
let syntax_tree = crate::macros::Tokens::parse::<$t>($($expr)*).unwrap();
let debug = crate::macros::debug::Lite(&syntax_tree);
- if !cfg!(miri) {
- insta::assert_debug_snapshot!(debug, @$snapshot);
- }
+ insta::assert_debug_snapshot!(debug, @$snapshot);
syntax_tree
}};
(($($expr:tt)*) , @$snapshot:literal) => {{
let syntax_tree = $($expr)*;
let debug = crate::macros::debug::Lite(&syntax_tree);
- if !cfg!(miri) {
- insta::assert_debug_snapshot!(debug, @$snapshot);
- }
+ insta::assert_debug_snapshot!(debug, @$snapshot);
syntax_tree
}};
(($($expr:tt)*) $next:tt $($rest:tt)*) => {
diff --git a/tests/regression.rs b/tests/regression.rs
deleted file mode 100644
index 8311a91b..00000000
--- a/tests/regression.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#![allow(clippy::let_underscore_drop)]
-
-mod regression {
- automod::dir!("tests/regression");
-}
diff --git a/tests/regression/issue1108.rs b/tests/regression/issue1108.rs
deleted file mode 100644
index 11a82ada..00000000
--- a/tests/regression/issue1108.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#[test]
-fn issue1108() {
- let data = "impl<x<>>::x for";
- let _ = syn::parse_file(data);
-}
diff --git a/tests/repo/mod.rs b/tests/repo/mod.rs
index 79e3018b..24b620c5 100644
--- a/tests/repo/mod.rs
+++ b/tests/repo/mod.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::manual_assert)]
-
mod progress;
use self::progress::Progress;
@@ -10,67 +8,30 @@ use std::path::Path;
use tar::Archive;
use walkdir::DirEntry;
-const REVISION: &str = "5e57faa78aa7661c6000204591558f6665f11abc";
+const REVISION: &str = "52e3dffa50cfffdcfa145c0cc0ba48b49abc0c07";
#[rustfmt::skip]
static EXCLUDE: &[&str] = &[
- // TODO: impl ~const T {}
- // https://github.com/dtolnay/syn/issues/1051
- "src/test/ui/rfc-2632-const-trait-impl/syntax.rs",
-
// Compile-fail expr parameter in const generic position: f::<1 + 2>()
- "src/test/ui/const-generics/early/closing-args-token.rs",
- "src/test/ui/const-generics/early/const-expression-parameter.rs",
+ "src/test/ui/const-generics/closing-args-token.rs",
+ "src/test/ui/const-generics/const-expression-parameter.rs",
// Deprecated anonymous parameter syntax in traits
"src/test/ui/issues/issue-13105.rs",
"src/test/ui/issues/issue-13775.rs",
"src/test/ui/issues/issue-34074.rs",
"src/test/ui/proc-macro/trait-fn-args-2015.rs",
- "src/tools/rustfmt/tests/source/trait.rs",
- "src/tools/rustfmt/tests/target/trait.rs",
-
- // Excessive nesting
- "src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs",
-
- // Testing rustfmt on invalid syntax
- "src/tools/rustfmt/tests/coverage/target/comments.rs",
- "src/tools/rustfmt/tests/parser/issue-4126/invalid.rs",
- "src/tools/rustfmt/tests/parser/issue_4418.rs",
- "src/tools/rustfmt/tests/parser/unclosed-delims/issue_4466.rs",
- "src/tools/rustfmt/tests/source/configs/disable_all_formatting/true.rs",
- "src/tools/rustfmt/tests/source/configs/spaces_around_ranges/false.rs",
- "src/tools/rustfmt/tests/source/configs/spaces_around_ranges/true.rs",
- "src/tools/rustfmt/tests/source/type.rs",
- "src/tools/rustfmt/tests/target/configs/spaces_around_ranges/false.rs",
- "src/tools/rustfmt/tests/target/configs/spaces_around_ranges/true.rs",
- "src/tools/rustfmt/tests/target/type.rs",
-
- // Clippy lint lists represented as expressions
- "src/tools/clippy/clippy_lints/src/lib.deprecated.rs",
- "src/tools/clippy/clippy_lints/src/lib.register_all.rs",
- "src/tools/clippy/clippy_lints/src/lib.register_cargo.rs",
- "src/tools/clippy/clippy_lints/src/lib.register_complexity.rs",
- "src/tools/clippy/clippy_lints/src/lib.register_correctness.rs",
- "src/tools/clippy/clippy_lints/src/lib.register_internal.rs",
- "src/tools/clippy/clippy_lints/src/lib.register_lints.rs",
- "src/tools/clippy/clippy_lints/src/lib.register_nursery.rs",
- "src/tools/clippy/clippy_lints/src/lib.register_pedantic.rs",
- "src/tools/clippy/clippy_lints/src/lib.register_perf.rs",
- "src/tools/clippy/clippy_lints/src/lib.register_restriction.rs",
- "src/tools/clippy/clippy_lints/src/lib.register_style.rs",
- "src/tools/clippy/clippy_lints/src/lib.register_suspicious.rs",
// Not actually test cases
"src/test/rustdoc-ui/test-compile-fail2.rs",
"src/test/rustdoc-ui/test-compile-fail3.rs",
+ "src/test/ui/include-single-expr-helper.rs",
+ "src/test/ui/include-single-expr-helper-1.rs",
"src/test/ui/json-bom-plus-crlf-multifile-aux.rs",
"src/test/ui/lint/expansion-time-include.rs",
"src/test/ui/macros/auxiliary/macro-comma-support.rs",
"src/test/ui/macros/auxiliary/macro-include-items-expr.rs",
- "src/test/ui/macros/include-single-expr-helper.rs",
- "src/test/ui/macros/include-single-expr-helper-1.rs",
- "src/test/ui/parser/issues/auxiliary/issue-21146-inc.rs",
+ "src/test/ui/parser/auxiliary/issue-21146-inc.rs",
];
pub fn base_dir_filter(entry: &DirEntry) -> bool {
@@ -78,7 +39,7 @@ pub fn base_dir_filter(entry: &DirEntry) -> bool {
if path.is_dir() {
return true; // otherwise walkdir does not visit the files
}
- if path.extension().map_or(true, |e| e != "rs") {
+ if path.extension().map(|e| e != "rs").unwrap_or(true) {
return false;
}
diff --git a/tests/test_derive_input.rs b/tests/test_derive_input.rs
index 93634e57..bf1ebdb6 100644
--- a/tests/test_derive_input.rs
+++ b/tests/test_derive_input.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::too_many_lines)]
-
#[macro_use]
mod macros;
diff --git a/tests/test_expr.rs b/tests/test_expr.rs
index 8c1cc73a..b2b65a25 100644
--- a/tests/test_expr.rs
+++ b/tests/test_expr.rs
@@ -300,21 +300,3 @@ fn test_macro_variable_match_arm() {
}
"###);
}
-
-// https://github.com/dtolnay/syn/issues/1019
-#[test]
-fn test_closure_vs_rangefull() {
- #[rustfmt::skip] // rustfmt bug: https://github.com/rust-lang/rustfmt/issues/4808
- let tokens = quote!(|| .. .method());
- snapshot!(tokens as Expr, @r###"
- Expr::MethodCall {
- receiver: Expr::Closure {
- output: Default,
- body: Expr::Range {
- limits: HalfOpen,
- },
- },
- method: "method",
- }
- "###);
-}
diff --git a/tests/test_generics.rs b/tests/test_generics.rs
index 330f02f4..b29434a1 100644
--- a/tests/test_generics.rs
+++ b/tests/test_generics.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::too_many_lines)]
-
#[macro_use]
mod macros;
diff --git a/tests/test_item.rs b/tests/test_item.rs
index 96df4b1a..712c6c6f 100644
--- a/tests/test_item.rs
+++ b/tests/test_item.rs
@@ -266,71 +266,3 @@ fn test_type_empty_bounds() {
}
"###);
}
-
-#[test]
-fn test_impl_visibility() {
- let tokens = quote! {
- pub default unsafe impl union {}
- };
-
- snapshot!(tokens as Item, @"Verbatim(`pub default unsafe impl union { }`)");
-}
-
-#[test]
-fn test_impl_type_parameter_defaults() {
- #[cfg(any())]
- impl<T = ()> () {}
- let tokens = quote! {
- impl<T = ()> () {}
- };
- snapshot!(tokens as Item, @r###"
- Item::Impl {
- generics: Generics {
- lt_token: Some,
- params: [
- Type(TypeParam {
- ident: "T",
- eq_token: Some,
- default: Some(Type::Tuple),
- }),
- ],
- gt_token: Some,
- },
- self_ty: Type::Tuple,
- }"###);
-}
-
-#[test]
-fn test_impl_trait_trailing_plus() {
- let tokens = quote! {
- fn f() -> impl Sized + {}
- };
-
- snapshot!(tokens as Item, @r###"
- Item::Fn {
- vis: Inherited,
- sig: Signature {
- ident: "f",
- generics: Generics,
- output: Type(
- Type::ImplTrait {
- bounds: [
- Trait(TraitBound {
- modifier: None,
- path: Path {
- segments: [
- PathSegment {
- ident: "Sized",
- arguments: None,
- },
- ],
- },
- }),
- ],
- },
- ),
- },
- block: Block,
- }
- "###);
-}
diff --git a/tests/test_lit.rs b/tests/test_lit.rs
index ebe077c6..099daf10 100644
--- a/tests/test_lit.rs
+++ b/tests/test_lit.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::float_cmp, clippy::non_ascii_literal)]
-
#[macro_use]
mod macros;
@@ -178,6 +176,7 @@ fn ints() {
#[test]
fn floats() {
+ #[cfg_attr(feature = "cargo-clippy", allow(float_cmp))]
fn test_float(s: &str, value: f64, suffix: &str) {
match lit(s) {
Lit::Float(lit) => {
@@ -216,6 +215,12 @@ fn negative() {
}
#[test]
+fn negative_overflow() {
+ assert!(syn::parse_str::<LitFloat>("-1.0e99f64").is_ok());
+ assert!(syn::parse_str::<LitFloat>("-1.0e999f64").is_err());
+}
+
+#[test]
fn suffix() {
fn get_suffix(token: &str) -> String {
let lit = syn::parse_str::<Lit>(token).unwrap();
diff --git a/tests/test_meta.rs b/tests/test_meta.rs
index 9b3f30de..de6cc4da 100644
--- a/tests/test_meta.rs
+++ b/tests/test_meta.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::shadow_unrelated, clippy::too_many_lines)]
-
#[macro_use]
mod macros;
diff --git a/tests/test_parse_buffer.rs b/tests/test_parse_buffer.rs
index cc23e9ba..57a3c7c3 100644
--- a/tests/test_parse_buffer.rs
+++ b/tests/test_parse_buffer.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::non_ascii_literal)]
-
use proc_macro2::{Delimiter, Group, Punct, Spacing, TokenStream, TokenTree};
use std::iter::FromIterator;
use syn::parse::{discouraged::Speculative, Parse, ParseStream, Parser, Result};
@@ -12,7 +10,7 @@ fn smuggled_speculative_cursor_between_sources() {
impl Parse for BreakRules {
fn parse(input1: ParseStream) -> Result<Self> {
let nested = |input2: ParseStream| {
- input1.advance_to(input2);
+ input1.advance_to(&input2);
Ok(Self)
};
nested.parse_str("")
diff --git a/tests/test_path.rs b/tests/test_path.rs
index c732eff7..e05b52ee 100644
--- a/tests/test_path.rs
+++ b/tests/test_path.rs
@@ -102,25 +102,3 @@ fn print_incomplete_qpath() {
"###);
assert!(ty.path.segments.pop().is_none());
}
-
-#[test]
-fn parse_parenthesized_path_arguments_with_disambiguator() {
- #[rustfmt::skip]
- let tokens = quote!(FnOnce::() -> !);
- snapshot!(tokens as Type, @r###"
- Type::Path {
- path: Path {
- segments: [
- PathSegment {
- ident: "FnOnce",
- arguments: PathArguments::Parenthesized {
- output: Type(
- Type::Never,
- ),
- },
- },
- ],
- },
- }
- "###);
-}
diff --git a/tests/test_precedence.rs b/tests/test_precedence.rs
index 7f8128e6..3eb2d348 100644
--- a/tests/test_precedence.rs
+++ b/tests/test_precedence.rs
@@ -1,13 +1,6 @@
#![cfg(not(syn_disable_nightly_tests))]
-#![cfg(not(miri))]
#![recursion_limit = "1024"]
#![feature(rustc_private)]
-#![allow(
- clippy::explicit_deref_methods,
- clippy::manual_assert,
- clippy::match_wildcard_for_single_variants,
- clippy::too_many_lines
-)]
//! The tests in this module do the following:
//!
@@ -135,16 +128,16 @@ fn test_rustc_precedence() {
l_failed
);
- passed.fetch_add(l_passed, Ordering::Relaxed);
- let prev_failed = failed.fetch_add(l_failed, Ordering::Relaxed);
+ passed.fetch_add(l_passed, Ordering::SeqCst);
+ let prev_failed = failed.fetch_add(l_failed, Ordering::SeqCst);
if prev_failed + l_failed >= abort_after {
process::exit(1);
}
});
- let passed = passed.load(Ordering::Relaxed);
- let failed = failed.load(Ordering::Relaxed);
+ let passed = passed.load(Ordering::SeqCst);
+ let failed = failed.load(Ordering::SeqCst);
errorf!("\n===== Precedence Test Results =====\n");
errorf!("{} passed | {} failed\n", passed, failed);
@@ -158,7 +151,7 @@ fn test_expressions(edition: Edition, exprs: Vec<syn::Expr>) -> (usize, usize) {
let mut passed = 0;
let mut failed = 0;
- rustc_span::create_session_if_not_set_then(edition, |_| {
+ rustc_span::with_session_globals(edition, || {
for expr in exprs {
let raw = quote!(#expr).to_string();
@@ -202,10 +195,10 @@ fn librustc_parse_and_rewrite(input: &str) -> Option<P<ast::Expr>> {
/// This method operates on librustc objects.
fn librustc_brackets(mut librustc_expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
use rustc_ast::ast::{
- Attribute, Block, BorrowKind, Expr, ExprField, ExprKind, GenericArg, Local, LocalKind, Pat,
- Stmt, StmtKind, StructExpr, StructRest, Ty,
+ Block, BorrowKind, Expr, ExprField, ExprKind, GenericArg, Pat, Stmt, StmtKind, StructExpr,
+ StructRest, Ty,
};
- use rustc_ast::mut_visit::{noop_visit_generic_arg, noop_visit_local, MutVisitor};
+ use rustc_ast::mut_visit::{noop_visit_generic_arg, MutVisitor};
use rustc_data_structures::map_in_place::MapInPlace;
use rustc_data_structures::thin_vec::ThinVec;
use rustc_span::DUMMY_SP;
@@ -247,13 +240,7 @@ fn librustc_brackets(mut librustc_expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
match &mut e.kind {
ExprKind::AddrOf(BorrowKind::Raw, ..) => {}
ExprKind::Struct(expr) => {
- let StructExpr {
- qself,
- path,
- fields,
- rest,
- } = expr.deref_mut();
- vis.visit_qself(qself);
+ let StructExpr { path, fields, rest } = expr.deref_mut();
vis.visit_path(path);
fields.flat_map_in_place(|field| flat_map_field(field, vis));
if let StructRest::Base(rest) = rest {
@@ -293,12 +280,8 @@ fn librustc_brackets(mut librustc_expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
fn visit_generic_arg(&mut self, arg: &mut GenericArg) {
match arg {
- // Don't wrap unbraced const generic arg as that's invalid syntax.
- GenericArg::Const(anon_const) => {
- if let ExprKind::Block(..) = &mut anon_const.value.kind {
- noop_visit_expr(&mut anon_const.value, self);
- }
- }
+ // Don't wrap const generic arg as that's invalid syntax.
+ GenericArg::Const(arg) => noop_visit_expr(&mut arg.value, self),
_ => noop_visit_generic_arg(arg, self),
}
}
@@ -311,13 +294,6 @@ fn librustc_brackets(mut librustc_expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
self.visit_span(&mut block.span);
}
- fn visit_local(&mut self, local: &mut P<Local>) {
- match local.kind {
- LocalKind::InitElse(..) => {}
- _ => noop_visit_local(local, self),
- }
- }
-
// We don't want to look at expressions that might appear in patterns or
// types yet. We'll look into comparing those in the future. For now
// focus on expressions appearing in other places.
@@ -328,10 +304,6 @@ fn librustc_brackets(mut librustc_expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
fn visit_ty(&mut self, ty: &mut P<Ty>) {
let _ = ty;
}
-
- fn visit_attribute(&mut self, attr: &mut Attribute) {
- let _ = attr;
- }
}
let mut folder = BracketsVisitor { failed: false };
@@ -347,8 +319,8 @@ fn librustc_brackets(mut librustc_expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
/// reveal the precedence of the parsed expressions, and produce a stringified
/// form of the resulting expression.
fn syn_brackets(syn_expr: syn::Expr) -> syn::Expr {
- use syn::fold::{fold_expr, fold_generic_argument, fold_generic_method_argument, Fold};
- use syn::{token, Expr, ExprParen, GenericArgument, GenericMethodArgument, Pat, Stmt, Type};
+ use syn::fold::*;
+ use syn::*;
struct ParenthesizeEveryExpr;
impl Fold for ParenthesizeEveryExpr {
@@ -368,11 +340,8 @@ fn syn_brackets(syn_expr: syn::Expr) -> syn::Expr {
fn fold_generic_argument(&mut self, arg: GenericArgument) -> GenericArgument {
match arg {
- GenericArgument::Const(arg) => GenericArgument::Const(match arg {
- Expr::Block(_) => fold_expr(self, arg),
- // Don't wrap unbraced const generic arg as that's invalid syntax.
- _ => arg,
- }),
+ // Don't wrap const generic arg as that's invalid syntax.
+ GenericArgument::Const(a) => GenericArgument::Const(fold_expr(self, a)),
_ => fold_generic_argument(self, arg),
}
}
@@ -382,11 +351,8 @@ fn syn_brackets(syn_expr: syn::Expr) -> syn::Expr {
arg: GenericMethodArgument,
) -> GenericMethodArgument {
match arg {
- GenericMethodArgument::Const(arg) => GenericMethodArgument::Const(match arg {
- Expr::Block(_) => fold_expr(self, arg),
- // Don't wrap unbraced const generic arg as that's invalid syntax.
- _ => arg,
- }),
+ // Don't wrap const generic arg as that's invalid syntax.
+ GenericMethodArgument::Const(a) => GenericMethodArgument::Const(fold_expr(self, a)),
_ => fold_generic_method_argument(self, arg),
}
}
@@ -395,13 +361,7 @@ fn syn_brackets(syn_expr: syn::Expr) -> syn::Expr {
match stmt {
// Don't wrap toplevel expressions in statements.
Stmt::Expr(e) => Stmt::Expr(fold_expr(self, e)),
- Stmt::Semi(e, semi) => {
- if let Expr::Verbatim(_) = e {
- Stmt::Semi(e, semi)
- } else {
- Stmt::Semi(fold_expr(self, e), semi)
- }
- }
+ Stmt::Semi(e, semi) => Stmt::Semi(fold_expr(self, e), semi),
s => s,
}
}
@@ -424,15 +384,15 @@ fn syn_brackets(syn_expr: syn::Expr) -> syn::Expr {
/// Walk through a crate collecting all expressions we can find in it.
fn collect_exprs(file: syn::File) -> Vec<syn::Expr> {
- use syn::fold::Fold;
+ use syn::fold::*;
use syn::punctuated::Punctuated;
- use syn::{token, Expr, ExprTuple};
+ use syn::*;
struct CollectExprs(Vec<Expr>);
impl Fold for CollectExprs {
fn fold_expr(&mut self, expr: Expr) -> Expr {
match expr {
- Expr::Verbatim(_) => {}
+ Expr::Verbatim(tokens) if tokens.is_empty() => {}
_ => self.0.push(expr),
}
diff --git a/tests/test_round_trip.rs b/tests/test_round_trip.rs
index 6c1cf222..e8ed3454 100644
--- a/tests/test_round_trip.rs
+++ b/tests/test_round_trip.rs
@@ -1,8 +1,6 @@
#![cfg(not(syn_disable_nightly_tests))]
-#![cfg(not(miri))]
#![recursion_limit = "1024"]
#![feature(rustc_private)]
-#![allow(clippy::manual_assert)]
extern crate rustc_ast;
extern crate rustc_errors;
@@ -16,7 +14,6 @@ use quote::quote;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use rustc_ast::ast::{
AngleBracketedArg, AngleBracketedArgs, Crate, GenericArg, GenericParamKind, Generics,
- WhereClause,
};
use rustc_ast::mut_visit::{self, MutVisitor};
use rustc_errors::PResult;
@@ -64,7 +61,7 @@ fn test_round_trip() {
}
});
- let failed = failed.load(Ordering::Relaxed);
+ let failed = failed.load(Ordering::SeqCst);
if failed > 0 {
panic!("{} failures", failed);
}
@@ -78,7 +75,7 @@ fn test(path: &Path, failed: &AtomicUsize, abort_after: usize) {
Ok(krate) => (krate, start.elapsed()),
Err(msg) => {
errorf!("=== {}: syn failed to parse\n{:?}\n", path.display(), msg);
- let prev_failed = failed.fetch_add(1, Ordering::Relaxed);
+ let prev_failed = failed.fetch_add(1, Ordering::SeqCst);
if prev_failed + 1 >= abort_after {
process::exit(1);
}
@@ -88,7 +85,7 @@ fn test(path: &Path, failed: &AtomicUsize, abort_after: usize) {
let back = quote!(#krate).to_string();
let edition = repo::edition(path).parse().unwrap();
- rustc_span::create_session_if_not_set_then(edition, |_| {
+ rustc_span::with_session_globals(edition, || {
let equal = match panic::catch_unwind(|| {
let sess = ParseSess::new(FilePathMapping::empty());
let before = match librustc_parse(content, &sess) {
@@ -147,7 +144,7 @@ fn test(path: &Path, failed: &AtomicUsize, abort_after: usize) {
}
};
if !equal {
- let prev_failed = failed.fetch_add(1, Ordering::Relaxed);
+ let prev_failed = failed.fetch_add(1, Ordering::SeqCst);
if prev_failed + 1 >= abort_after {
process::exit(1);
}
@@ -197,12 +194,6 @@ fn normalize(krate: &mut Crate) {
});
mut_visit::noop_visit_generics(e, self);
}
-
- fn visit_where_clause(&mut self, e: &mut WhereClause) {
- if e.predicates.is_empty() {
- e.has_where_token = false;
- }
- }
}
NormalizeVisitor.visit_crate(krate);
diff --git a/tests/test_size.rs b/tests/test_size.rs
index e172df2b..01e84011 100644
--- a/tests/test_size.rs
+++ b/tests/test_size.rs
@@ -1,7 +1,7 @@
#![cfg(target_pointer_width = "64")]
use std::mem;
-use syn::{Expr, Item, Lit, Pat, Type};
+use syn::*;
#[test]
fn test_expr_size() {
diff --git a/tests/test_stmt.rs b/tests/test_stmt.rs
index dbe1c765..943d856e 100644
--- a/tests/test_stmt.rs
+++ b/tests/test_stmt.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::non_ascii_literal)]
-
#[macro_use]
mod macros;
diff --git a/tests/test_ty.rs b/tests/test_ty.rs
index a03abaa3..7e20dd99 100644
--- a/tests/test_ty.rs
+++ b/tests/test_ty.rs
@@ -217,135 +217,3 @@ fn test_group_colons() {
}
"###);
}
-
-#[test]
-fn test_trait_object() {
- let tokens = quote!(dyn for<'a> Trait<'a> + 'static);
- snapshot!(tokens as Type, @r###"
- Type::TraitObject {
- dyn_token: Some,
- bounds: [
- Trait(TraitBound {
- modifier: None,
- lifetimes: Some(BoundLifetimes {
- lifetimes: [
- LifetimeDef {
- lifetime: Lifetime {
- ident: "a",
- },
- },
- ],
- }),
- path: Path {
- segments: [
- PathSegment {
- ident: "Trait",
- arguments: PathArguments::AngleBracketed {
- args: [
- Lifetime(Lifetime {
- ident: "a",
- }),
- ],
- },
- },
- ],
- },
- }),
- Lifetime(Lifetime {
- ident: "static",
- }),
- ],
- }
- "###);
-
- let tokens = quote!(dyn 'a + Trait);
- snapshot!(tokens as Type, @r###"
- Type::TraitObject {
- dyn_token: Some,
- bounds: [
- Lifetime(Lifetime {
- ident: "a",
- }),
- Trait(TraitBound {
- modifier: None,
- path: Path {
- segments: [
- PathSegment {
- ident: "Trait",
- arguments: None,
- },
- ],
- },
- }),
- ],
- }
- "###);
-
- // None of the following are valid Rust types.
- syn::parse_str::<Type>("for<'a> dyn Trait<'a>").unwrap_err();
- syn::parse_str::<Type>("dyn for<'a> 'a + Trait").unwrap_err();
-}
-
-#[test]
-fn test_trailing_plus() {
- #[rustfmt::skip]
- let tokens = quote!(impl Trait +);
- snapshot!(tokens as Type, @r###"
- Type::ImplTrait {
- bounds: [
- Trait(TraitBound {
- modifier: None,
- path: Path {
- segments: [
- PathSegment {
- ident: "Trait",
- arguments: None,
- },
- ],
- },
- }),
- ],
- }
- "###);
-
- #[rustfmt::skip]
- let tokens = quote!(dyn Trait +);
- snapshot!(tokens as Type, @r###"
- Type::TraitObject {
- dyn_token: Some,
- bounds: [
- Trait(TraitBound {
- modifier: None,
- path: Path {
- segments: [
- PathSegment {
- ident: "Trait",
- arguments: None,
- },
- ],
- },
- }),
- ],
- }
- "###);
-
- #[rustfmt::skip]
- let tokens = quote!(Trait +);
- snapshot!(tokens as Type, @r###"
- Type::TraitObject {
- bounds: [
- Trait(TraitBound {
- modifier: None,
- path: Path {
- segments: [
- PathSegment {
- ident: "Trait",
- arguments: None,
- },
- ],
- },
- }),
- ],
- }
- "###);
-}