aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 07:04:50 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 07:04:50 +0000
commitae0affa153996e0f688c6a6b07f730f634948d99 (patch)
tree21d839a1cbf9c861c49c24db0822d82b28db9f96
parentcd91b2eed3e1243f3ac9c1c8fc5194f7eb933feb (diff)
parent3a88f25a9fb1f39f92ea9a8164eb3c881475b23c (diff)
downloadsyn-android13-mainline-sdkext-release.tar.gz
Change-Id: Ia683de9d241fd90c41b9c483d1ae58658d24894e
-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, 2702 insertions, 2130 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 36a487f8..cb0b7f12 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,6 @@
{
"git": {
- "sha1": "c80b47159a47340d20f5774d2fe1c09bd0994a13"
- }
-}
+ "sha1": "7ff292d5ac9802a3cc7908c5641a060bd5cf0d78"
+ },
+ "path_in_vcs": ""
+} \ No newline at end of file
diff --git a/Android.bp b/Android.bp
index 7445c4c0..1ec1d6c2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,4 @@
-// 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.
+// This file is generated by cargo2android.py --config cargo2android.json.
// Do not modify this file as changes will be overridden on upgrade.
package {
@@ -40,6 +40,8 @@ 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: [
@@ -55,9 +57,7 @@ rust_library_host {
"visit",
"visit-mut",
],
- flags: [
- "--cfg syn_disable_nightly_tests",
- ],
+ cfgs: ["syn_disable_nightly_tests"],
rustlibs: [
"libproc_macro2",
"libquote",
@@ -65,8 +65,3 @@ 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 b2dbe617..11f06196 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 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)
+# 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.
[package]
edition = "2018"
+rust-version = "1.31"
name = "syn"
-version = "1.0.69"
+version = "1.0.86"
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.26"
+version = "1.0.32"
default-features = false
[dependencies.quote]
@@ -52,6 +52,9 @@ version = "0.2"
[dev-dependencies.anyhow]
version = "1.0"
+[dev-dependencies.automod]
+version = "1.0"
+
[dev-dependencies.flate2]
version = "1.0"
@@ -68,7 +71,7 @@ version = "1.0"
version = "1.0"
[dev-dependencies.reqwest]
-version = "0.10"
+version = "0.11"
features = ["blocking"]
[dev-dependencies.syn-test-suite]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index d29b93db..b6fc02a3 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "syn"
-version = "1.0.69" # don't forget to update html_root_url and syn.json
+version = "1.0.86" # 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,6 +19,7 @@ include = [
"/tests/**",
]
edition = "2018"
+rust-version = "1.31"
[features]
default = ["derive", "parsing", "printing", "clone-impls", "proc-macro"]
@@ -35,18 +36,19 @@ proc-macro = ["proc-macro2/proc-macro", "quote/proc-macro"]
test = ["syn-test-suite/all-features"]
[dependencies]
-proc-macro2 = { version = "1.0.26", default-features = false }
+proc-macro2 = { version = "1.0.32", 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.10", features = ["blocking"] }
+reqwest = { version = "0.11", features = ["blocking"] }
syn-test-suite = { version = "0", path = "tests/features" }
tar = "0.4.16"
termcolor = "1.0"
@@ -70,4 +72,4 @@ rustdoc-args = ["--cfg", "doc_cfg"]
features = ["full", "visit", "visit-mut", "fold", "extra-traits"]
[workspace]
-members = ["dev", "json", "tests/features"]
+members = ["dev", "json", "tests/crates", "tests/features"]
diff --git a/METADATA b/METADATA
index 366fd603..e4a80129 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/syn/syn-1.0.69.crate"
+ value: "https://static.crates.io/crates/syn/syn-1.0.86.crate"
}
- version: "1.0.69"
+ version: "1.0.86"
license_type: NOTICE
last_upgrade_date {
- year: 2021
- month: 4
- day: 13
+ year: 2022
+ month: 3
+ day: 1
}
}
diff --git a/README.md b/README.md
index 12b5f45b..38005f5e 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 ff7187ba..bff320d4 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,221 +1,228 @@
// Generated by update_crate_tests.py for tests that depend on this crate.
{
- "presubmit": [
+ "imports": [
{
- "name": "ZipFuseTest"
+ "path": "external/rust/crates/anyhow"
},
{
- "name": "anyhow_device_test_src_lib"
+ "path": "external/rust/crates/arbitrary"
},
{
- "name": "anyhow_device_test_tests_test_autotrait"
+ "path": "external/rust/crates/argh"
},
{
- "name": "anyhow_device_test_tests_test_boxed"
+ "path": "external/rust/crates/base64"
},
{
- "name": "anyhow_device_test_tests_test_chain"
+ "path": "external/rust/crates/bitflags"
},
{
- "name": "anyhow_device_test_tests_test_context"
+ "path": "external/rust/crates/bytes"
},
{
- "name": "anyhow_device_test_tests_test_convert"
+ "path": "external/rust/crates/either"
},
{
- "name": "anyhow_device_test_tests_test_downcast"
+ "path": "external/rust/crates/futures-util"
},
{
- "name": "anyhow_device_test_tests_test_ffi"
+ "path": "external/rust/crates/jni"
},
{
- "name": "anyhow_device_test_tests_test_fmt"
+ "path": "external/rust/crates/libm"
},
{
- "name": "anyhow_device_test_tests_test_macros"
+ "path": "external/rust/crates/oid-registry"
},
{
- "name": "anyhow_device_test_tests_test_repr"
+ "path": "external/rust/crates/rand_chacha"
},
{
- "name": "anyhow_device_test_tests_test_source"
+ "path": "external/rust/crates/serde"
},
{
- "name": "authfs_device_test_src_lib"
+ "path": "external/rust/crates/serde-xml-rs"
},
{
- "name": "doh_unit_test"
+ "path": "external/rust/crates/serde_cbor"
},
{
- "name": "either_device_test_src_lib"
+ "path": "external/rust/crates/slab"
},
{
- "name": "futures-util_device_test_src_lib"
+ "path": "external/rust/crates/tinytemplate"
},
{
- "name": "keystore2_crypto_test_rust"
+ "path": "external/rust/crates/tinyvec"
},
{
- "name": "keystore2_selinux_test"
+ "path": "external/rust/crates/tokio"
},
{
- "name": "keystore2_test"
+ "path": "external/rust/crates/tokio-test"
},
{
- "name": "libm_device_test_src_lib"
+ "path": "external/rust/crates/unicode-bidi"
},
{
- "name": "serde_cbor_device_test_src_lib"
+ "path": "external/rust/crates/unicode-xid"
},
{
- "name": "serde_cbor_device_test_tests_bennofs"
- },
+ "path": "external/rust/crates/url"
+ }
+ ],
+ "presubmit": [
{
- "name": "serde_cbor_device_test_tests_canonical"
+ "name": "ZipFuseTest"
},
{
- "name": "serde_cbor_device_test_tests_de"
+ "name": "apkdmverity.test"
},
{
- "name": "serde_cbor_device_test_tests_enum"
+ "name": "authfs_device_test_src_lib"
},
{
- "name": "serde_cbor_device_test_tests_ser"
+ "name": "diced_open_dice_cbor_test"
},
{
- "name": "serde_cbor_device_test_tests_std_types"
+ "name": "diced_sample_inputs_test"
},
{
- "name": "serde_cbor_device_test_tests_tags"
+ "name": "diced_test"
},
{
- "name": "serde_cbor_device_test_tests_value"
+ "name": "diced_utils_test"
},
{
- "name": "serde_test_device_test_src_lib"
+ "name": "diced_vendor_test"
},
{
- "name": "tokio-test_device_test_src_lib"
+ "name": "doh_unit_test"
},
{
- "name": "tokio-test_device_test_tests_block_on"
+ "name": "keystore2_crypto_test_rust"
},
{
- "name": "tokio-test_device_test_tests_io"
+ "name": "keystore2_km_compat_test"
},
{
- "name": "tokio-test_device_test_tests_macros"
+ "name": "keystore2_selinux_concurrency_test"
},
{
- "name": "tokio_device_test_tests_buffered"
+ "name": "keystore2_selinux_test"
},
{
- "name": "tokio_device_test_tests_io_async_read"
+ "name": "keystore2_test"
},
{
- "name": "tokio_device_test_tests_io_copy_bidirectional"
+ "name": "keystore2_test_utils_test"
},
{
- "name": "tokio_device_test_tests_io_lines"
+ "name": "keystore2_vintf_test"
},
{
- "name": "tokio_device_test_tests_io_mem_stream"
+ "name": "legacykeystore_test"
},
{
- "name": "tokio_device_test_tests_io_read"
+ "name": "libapkverify.integration_test"
},
{
- "name": "tokio_device_test_tests_io_read_buf"
+ "name": "libapkverify.test"
},
{
- "name": "tokio_device_test_tests_io_read_to_end"
+ "name": "libcert_request_validator_tests"
},
{
- "name": "tokio_device_test_tests_io_take"
+ "name": "libidsig.test"
},
{
- "name": "tokio_device_test_tests_io_write"
+ "name": "librustutils_test"
},
{
- "name": "tokio_device_test_tests_io_write_all"
+ "name": "microdroid_manager_test"
},
{
- "name": "tokio_device_test_tests_io_write_buf"
+ "name": "rustBinderTest"
},
{
- "name": "tokio_device_test_tests_io_write_int"
+ "name": "virtualizationservice_device_test"
+ }
+ ],
+ "presubmit-rust": [
+ {
+ "name": "ZipFuseTest"
},
{
- "name": "tokio_device_test_tests_macros_join"
+ "name": "apkdmverity.test"
},
{
- "name": "tokio_device_test_tests_no_rt"
+ "name": "authfs_device_test_src_lib"
},
{
- "name": "tokio_device_test_tests_rt_basic"
+ "name": "diced_open_dice_cbor_test"
},
{
- "name": "tokio_device_test_tests_rt_threaded"
+ "name": "diced_sample_inputs_test"
},
{
- "name": "tokio_device_test_tests_sync_barrier"
+ "name": "diced_test"
},
{
- "name": "tokio_device_test_tests_sync_broadcast"
+ "name": "diced_utils_test"
},
{
- "name": "tokio_device_test_tests_sync_errors"
+ "name": "diced_vendor_test"
},
{
- "name": "tokio_device_test_tests_sync_mpsc"
+ "name": "doh_unit_test"
},
{
- "name": "tokio_device_test_tests_sync_mutex_owned"
+ "name": "keystore2_crypto_test_rust"
},
{
- "name": "tokio_device_test_tests_sync_rwlock"
+ "name": "keystore2_km_compat_test"
},
{
- "name": "tokio_device_test_tests_sync_watch"
+ "name": "keystore2_selinux_concurrency_test"
},
{
- "name": "tokio_device_test_tests_task_local"
+ "name": "keystore2_selinux_test"
},
{
- "name": "tokio_device_test_tests_task_local_set"
+ "name": "keystore2_test"
},
{
- "name": "tokio_device_test_tests_tcp_accept"
+ "name": "keystore2_test_utils_test"
},
{
- "name": "tokio_device_test_tests_tcp_echo"
+ "name": "keystore2_vintf_test"
},
{
- "name": "tokio_device_test_tests_tcp_into_std"
+ "name": "legacykeystore_test"
},
{
- "name": "tokio_device_test_tests_tcp_shutdown"
+ "name": "libapkverify.integration_test"
},
{
- "name": "tokio_device_test_tests_time_rt"
+ "name": "libapkverify.test"
},
{
- "name": "tokio_device_test_tests_uds_split"
+ "name": "libcert_request_validator_tests"
},
{
- "name": "unicode-bidi_device_test_src_lib"
+ "name": "libidsig.test"
},
{
- "name": "url_device_test_src_lib"
+ "name": "librustutils_test"
},
{
- "name": "url_device_test_tests_data"
+ "name": "microdroid_manager_test"
},
{
- "name": "url_device_test_tests_unit"
+ "name": "rustBinderTest"
},
{
- "name": "vpnprofilestore_test"
+ "name": "virtualizationservice_device_test"
}
]
}
diff --git a/benches/file.rs b/benches/file.rs
index 58ab8df2..86204df2 100644
--- a/benches/file.rs
+++ b/benches/file.rs
@@ -2,6 +2,7 @@
#![feature(rustc_private, test)]
#![recursion_limit = "1024"]
+#![allow(clippy::missing_panics_doc, clippy::must_use_candidate)]
extern crate test;
@@ -19,7 +20,7 @@ use std::fs;
use std::str::FromStr;
use test::Bencher;
-const FILE: &str = "tests/rust/src/libcore/str/mod.rs";
+const FILE: &str = "tests/rust/library/core/src/str/mod.rs";
#[bench]
fn parse_file(b: &mut Bencher) {
diff --git a/benches/rust.rs b/benches/rust.rs
index 50e1a7f6..54542932 100644
--- a/benches/rust.rs
+++ b/benches/rust.rs
@@ -5,6 +5,7 @@
#![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"]
@@ -58,7 +59,7 @@ mod librustc_parse {
}
}
- rustc_span::with_session_globals(Edition::Edition2018, || {
+ rustc_span::create_session_if_not_set_then(Edition::Edition2018, |_| {
let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let emitter = Box::new(SilentEmitter);
let handler = Handler::with_emitter(false, None, emitter);
@@ -116,7 +117,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 25190f4c..c705fc50 100644
--- a/build.rs
+++ b/build.rs
@@ -19,6 +19,10 @@ 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");
}
@@ -38,6 +42,6 @@ fn rustc_version() -> Option<Compiler> {
return None;
}
let minor = pieces.next()?.parse().ok()?;
- let nightly = version.contains("nightly");
+ let nightly = version.contains("nightly") || version.ends_with("-dev");
Some(Compiler { minor, nightly })
}
diff --git a/cargo2android.json b/cargo2android.json
new file mode 100644
index 00000000..5f9ce448
--- /dev/null
+++ b/cargo2android.json
@@ -0,0 +1,5 @@
+{
+ "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 794a3104..bace94f4 100644
--- a/src/attr.rs
+++ b/src/attr.rs
@@ -2,6 +2,7 @@ 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};
@@ -250,9 +251,7 @@ impl Attribute {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
pub fn parse_inner(input: ParseStream) -> Result<Vec<Self>> {
let mut attrs = Vec::new();
- while input.peek(Token![#]) && input.peek2(Token![!]) {
- attrs.push(input.call(parsing::single_parse_inner)?);
- }
+ parsing::parse_inner(input, &mut attrs)?;
Ok(attrs)
}
}
@@ -471,11 +470,8 @@ pub trait FilterAttrs<'a> {
fn inner(self) -> Self::Ret;
}
-impl<'a, T> FilterAttrs<'a> for T
-where
- T: IntoIterator<Item = &'a Attribute>,
-{
- type Ret = iter::Filter<T::IntoIter, fn(&&Attribute) -> bool>;
+impl<'a> FilterAttrs<'a> for &'a [Attribute] {
+ type Ret = iter::Filter<slice::Iter<'a, Attribute>, fn(&&Attribute) -> bool>;
fn outer(self) -> Self::Ret {
fn is_outer(attr: &&Attribute) -> bool {
@@ -484,7 +480,7 @@ where
AttrStyle::Inner(_) => false,
}
}
- self.into_iter().filter(is_outer)
+ self.iter().filter(is_outer)
}
fn inner(self) -> Self::Ret {
@@ -494,7 +490,7 @@ where
AttrStyle::Outer => false,
}
}
- self.into_iter().filter(is_inner)
+ self.iter().filter(is_inner)
}
}
@@ -503,8 +499,13 @@ pub mod parsing {
use super::*;
use crate::ext::IdentExt;
use crate::parse::{Parse, ParseStream, Result};
- #[cfg(feature = "full")]
- use crate::private;
+
+ 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(())
+ }
pub fn single_parse_inner(input: ParseStream) -> Result<Attribute> {
let content;
@@ -528,15 +529,6 @@ 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 {
@@ -655,7 +647,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 ec172259..43e77e97 100644
--- a/src/buffer.rs
+++ b/src/buffer.rs
@@ -16,6 +16,7 @@ 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`.
@@ -36,20 +37,30 @@ enum Entry {
///
/// *This type is available only if Syn is built with the `"parsing"` feature.*
pub struct TokenBuffer {
- // 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]>,
+ // 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);
+ }
+ }
}
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 seqs = Vec::new();
+ let mut groups = Vec::new();
for tt in stream {
match tt {
TokenTree::Ident(sym) => {
@@ -63,8 +74,8 @@ impl TokenBuffer {
}
TokenTree::Group(g) => {
// Record the index of the interesting entry, and store an
- // `End(null)` there temporarially.
- seqs.push((entries.len(), g));
+ // `End(null)` there temporarily.
+ groups.push((entries.len(), g));
entries.push(Entry::End(ptr::null()));
}
}
@@ -78,23 +89,28 @@ 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 seqs {
+ for (idx, group) in groups {
// 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 seq_up = &entries[idx + 1] as *const Entry;
+ let group_up = unsafe { entries.as_ptr().add(idx + 1) };
// 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(), seq_up);
+ let inner = Self::inner_new(group.stream(), group_up);
entries[idx] = Entry::Group(group, inner);
}
- TokenBuffer { data: entries }
+ let len = entries.len();
+ let ptr = Box::into_raw(entries);
+ TokenBuffer {
+ ptr: ptr as *const Entry,
+ len,
+ }
}
/// Creates a `TokenBuffer` containing all the tokens from the input
- /// `TokenStream`.
+ /// `proc_macro::TokenStream`.
///
/// *This method is available only if Syn is built with both the `"parsing"` and
/// `"proc-macro"` features.*
@@ -102,20 +118,20 @@ impl TokenBuffer {
not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
feature = "proc-macro"
))]
- pub fn new(stream: pm::TokenStream) -> TokenBuffer {
+ pub fn new(stream: pm::TokenStream) -> Self {
Self::new2(stream.into())
}
/// Creates a `TokenBuffer` containing all the tokens from the input
- /// `TokenStream`.
- pub fn new2(stream: TokenStream) -> TokenBuffer {
+ /// `proc_macro2::TokenStream`.
+ pub fn new2(stream: TokenStream) -> Self {
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.data[0], &self.data[self.data.len() - 1]) }
+ unsafe { Cursor::create(self.ptr, self.ptr.add(self.len - 1)) }
}
}
@@ -210,7 +226,7 @@ impl<'a> Cursor<'a> {
// situations where we should immediately exit the span after
// entering it are handled correctly.
unsafe {
- *self = Cursor::create(&buf.data[0], self.scope);
+ *self = Cursor::create(buf.ptr, self.scope);
}
} else {
break;
@@ -254,7 +270,7 @@ impl<'a> Cursor<'a> {
}
}
- /// If the cursor is pointing at an `Punct`, returns it along with a cursor
+ /// If the cursor is pointing at a `Punct`, returns it along with a cursor
/// pointing at the next `TokenTree`.
pub fn punct(mut self) -> Option<(Punct, Cursor<'a>)> {
self.ignore_none();
@@ -321,9 +337,7 @@ 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 731f5a0a..dc2138c1 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 attrs = input.call(Attribute::parse_outer)?;
+ let mut 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: 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
- }
- },
+ ident,
+ fields,
+ discriminant,
})
}
}
@@ -295,6 +295,17 @@ 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")))]
@@ -302,7 +313,11 @@ pub mod parsing {
Ok(Field {
attrs: input.call(Attribute::parse_outer)?,
vis: input.parse()?,
- ident: Some(input.parse()?),
+ ident: Some(if input.peek(Token![_]) {
+ input.call(Ident::parse_any)
+ } else {
+ input.parse()
+ }?),
colon_token: Some(input.parse()?),
ty: input.parse()?,
})
@@ -464,7 +479,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 af9bb91b..17387e45 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 attrs = input.call(Attribute::parse_outer)?;
+ let mut 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)?;
+ let (where_clause, fields, semi) = data_struct(input, &mut attrs)?;
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)?;
+ let (where_clause, brace, variants) = data_enum(input, &mut attrs)?;
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)?;
+ let (where_clause, fields) = data_union(input, &mut attrs)?;
Ok(DeriveInput {
attrs,
vis,
@@ -163,6 +163,7 @@ 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;
@@ -187,7 +188,7 @@ pub mod parsing {
Err(lookahead.error())
}
} else if lookahead.peek(token::Brace) {
- let fields = input.parse()?;
+ let fields = data::parsing::parse_braced(input, attrs)?;
Ok((where_clause, Fields::Named(fields), None))
} else if lookahead.peek(Token![;]) {
let semi = input.parse()?;
@@ -199,6 +200,7 @@ pub mod parsing {
pub fn data_enum(
input: ParseStream,
+ attrs: &mut Vec<Attribute>,
) -> Result<(
Option<WhereClause>,
token::Brace,
@@ -208,14 +210,18 @@ 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) -> Result<(Option<WhereClause>, FieldsNamed)> {
+ pub fn data_union(
+ input: ParseStream,
+ attrs: &mut Vec<Attribute>,
+ ) -> Result<(Option<WhereClause>, FieldsNamed)> {
let where_clause = input.parse()?;
- let fields = input.parse()?;
+ let fields = data::parsing::parse_braced(input, attrs)?;
Ok((where_clause, fields))
}
}
diff --git a/src/discouraged.rs b/src/discouraged.rs
index 76c9fce6..a46129b6 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 780731c8..b505b894 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -47,10 +47,11 @@ pub type Result<T> = std::result::Result<T, Error>;
/// ```
///
/// For errors that arise later than the initial parsing stage, the
-/// [`.to_compile_error()`] method can be used to perform an explicit conversion
-/// to `compile_error!`.
+/// [`.to_compile_error()`] or [`.into_compile_error()`] methods 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;
@@ -66,7 +67,7 @@ pub type Result<T> = std::result::Result<T, Error>;
///
/// // fn(DeriveInput) -> syn::Result<proc_macro2::TokenStream>
/// expand::my_derive(input)
-/// .unwrap_or_else(|err| err.to_compile_error())
+/// .unwrap_or_else(syn::Error::into_compile_error)
/// .into()
/// }
/// #
@@ -236,7 +237,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 601a214b..d3a08784 100644
--- a/src/export.rs
+++ b/src/export.rs
@@ -1,6 +1,5 @@
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 a35532d4..95da0908 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 asyncness: Option<Token![async]>,
pub movability: Option<Token![static]>,
+ pub asyncness: Option<Token![async]>,
pub capture: Option<Token![move]>,
pub or1_token: Token![|],
pub inputs: Punctuated<Pat, Token![,]>,
@@ -851,6 +851,24 @@ 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 {
@@ -1322,6 +1340,7 @@ 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
@@ -1523,7 +1542,7 @@ pub(crate) mod parsing {
// <atom> ? ...
#[cfg(feature = "full")]
fn trailer_expr(
- outer_attrs: Vec<Attribute>,
+ mut attrs: Vec<Attribute>,
input: ParseStream,
allow_struct: AllowStruct,
) -> Result<Expr> {
@@ -1531,7 +1550,7 @@ pub(crate) mod parsing {
let mut e = trailer_helper(input, atom)?;
let inner_attrs = e.replace_attrs(Vec::new());
- let attrs = private::attrs(outer_attrs, inner_attrs);
+ attrs.extend(inner_attrs);
e.replace_attrs(attrs);
Ok(e)
}
@@ -1547,7 +1566,13 @@ pub(crate) mod parsing {
paren_token: parenthesized!(content in input),
args: content.parse_terminated(Expr::parse)?,
});
- } else if input.peek(Token![.]) && !input.peek(Token![..]) {
+ } else if input.peek(Token![.])
+ && !input.peek(Token![..])
+ && match e {
+ Expr::Range(_) => false,
+ _ => true,
+ }
+ {
let mut dot_token: Token![.] = input.parse()?;
let await_token: Option<token::Await> = input.parse()?;
@@ -1799,12 +1824,10 @@ 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 input.peek(Token![!]) && !input.peek(Token![!=]) {
+ if expr.qself.is_none() && input.peek(Token![!]) && !input.peek(Token![!=]) {
let mut contains_arguments = false;
for segment in &expr.path.segments {
match segment.arguments {
@@ -1832,7 +1855,12 @@ pub(crate) mod parsing {
if allow_struct.0 && input.peek(token::Brace) {
let outer_attrs = Vec::new();
- expr_struct_helper(input, outer_attrs, expr.path).map(Expr::Struct)
+ 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))
+ }
} else {
Ok(Expr::Path(expr))
}
@@ -2084,7 +2112,11 @@ pub(crate) mod parsing {
let_token: input.parse()?,
pat: pat::parsing::multi_pat_with_leading_vert(input)?,
eq_token: input.parse()?,
- expr: Box::new(input.call(Expr::parse_without_eager_brace)?),
+ expr: Box::new({
+ let allow_struct = AllowStruct(false);
+ let lhs = unary_expr(input, allow_struct)?;
+ parse_expr(input, lhs, allow_struct, Precedence::Compare)?
+ }),
})
}
}
@@ -2134,7 +2166,7 @@ pub(crate) mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprForLoop {
fn parse(input: ParseStream) -> Result<Self> {
- let outer_attrs = input.call(Attribute::parse_outer)?;
+ let mut attrs = input.call(Attribute::parse_outer)?;
let label: Option<Label> = input.parse()?;
let for_token: Token![for] = input.parse()?;
@@ -2145,11 +2177,11 @@ pub(crate) mod parsing {
let content;
let brace_token = braced!(content in input);
- let inner_attrs = content.call(Attribute::parse_inner)?;
+ attr::parsing::parse_inner(&content, &mut attrs)?;
let stmts = content.call(Block::parse_within)?;
Ok(ExprForLoop {
- attrs: private::attrs(outer_attrs, inner_attrs),
+ attrs,
label,
for_token,
pat,
@@ -2164,17 +2196,17 @@ pub(crate) mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprLoop {
fn parse(input: ParseStream) -> Result<Self> {
- let outer_attrs = input.call(Attribute::parse_outer)?;
+ let mut 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);
- let inner_attrs = content.call(Attribute::parse_inner)?;
+ attr::parsing::parse_inner(&content, &mut attrs)?;
let stmts = content.call(Block::parse_within)?;
Ok(ExprLoop {
- attrs: private::attrs(outer_attrs, inner_attrs),
+ attrs,
label,
loop_token,
body: Block { brace_token, stmts },
@@ -2186,13 +2218,13 @@ pub(crate) mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprMatch {
fn parse(input: ParseStream) -> Result<Self> {
- let outer_attrs = input.call(Attribute::parse_outer)?;
+ let mut 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);
- let inner_attrs = content.call(Attribute::parse_inner)?;
+ attr::parsing::parse_inner(&content, &mut attrs)?;
let mut arms = Vec::new();
while !content.is_empty() {
@@ -2200,7 +2232,7 @@ pub(crate) mod parsing {
}
Ok(ExprMatch {
- attrs: private::attrs(outer_attrs, inner_attrs),
+ attrs,
match_token,
expr: Box::new(expr),
brace_token,
@@ -2369,12 +2401,8 @@ 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()?;
@@ -2412,8 +2440,8 @@ pub(crate) mod parsing {
Ok(ExprClosure {
attrs: Vec::new(),
- asyncness,
movability,
+ asyncness,
capture,
or1_token,
inputs,
@@ -2480,18 +2508,18 @@ pub(crate) mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprWhile {
fn parse(input: ParseStream) -> Result<Self> {
- let outer_attrs = input.call(Attribute::parse_outer)?;
+ let mut 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);
- let inner_attrs = content.call(Attribute::parse_inner)?;
+ attr::parsing::parse_inner(&content, &mut attrs)?;
let stmts = content.call(Block::parse_within)?;
Ok(ExprWhile {
- attrs: private::attrs(outer_attrs, inner_attrs),
+ attrs,
label,
while_token,
cond: Box::new(cond),
@@ -2620,13 +2648,12 @@ pub(crate) mod parsing {
#[cfg(feature = "full")]
fn expr_struct_helper(
input: ParseStream,
- outer_attrs: Vec<Attribute>,
+ mut attrs: Vec<Attribute>,
path: Path,
) -> Result<ExprStruct> {
let content;
let brace_token = braced!(content in input);
- let inner_attrs = content.call(Attribute::parse_inner)?;
- let attrs = private::attrs(outer_attrs, inner_attrs);
+ attr::parsing::parse_inner(&content, &mut attrs)?;
let mut fields = Punctuated::new();
while !content.is_empty() {
@@ -2699,16 +2726,16 @@ pub(crate) mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprBlock {
fn parse(input: ParseStream) -> Result<Self> {
- let outer_attrs = input.call(Attribute::parse_outer)?;
+ let mut attrs = input.call(Attribute::parse_outer)?;
let label: Option<Label> = input.parse()?;
let content;
let brace_token = braced!(content in input);
- let inner_attrs = content.call(Attribute::parse_inner)?;
+ attr::parsing::parse_inner(&content, &mut attrs)?;
let stmts = content.call(Block::parse_within)?;
Ok(ExprBlock {
- attrs: private::attrs(outer_attrs, inner_attrs),
+ attrs,
label,
block: Block { brace_token, stmts },
})
@@ -2725,6 +2752,7 @@ 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
@@ -2919,7 +2947,7 @@ pub(crate) mod printing {
self.bracket_token.surround(tokens, |tokens| {
inner_attrs_to_tokens(&self.attrs, tokens);
self.elems.to_tokens(tokens);
- })
+ });
}
}
@@ -2930,7 +2958,7 @@ pub(crate) mod printing {
self.func.to_tokens(tokens);
self.paren_token.surround(tokens, |tokens| {
self.args.to_tokens(tokens);
- })
+ });
}
}
@@ -2984,7 +3012,7 @@ pub(crate) mod printing {
if self.elems.len() == 1 && !self.elems.trailing_punct() {
<Token![,]>::default().to_tokens(tokens);
}
- })
+ });
}
}
@@ -3195,8 +3223,8 @@ pub(crate) mod printing {
impl ToTokens for ExprClosure {
fn to_tokens(&self, tokens: &mut TokenStream) {
outer_attrs_to_tokens(&self.attrs, tokens);
- self.asyncness.to_tokens(tokens);
self.movability.to_tokens(tokens);
+ self.asyncness.to_tokens(tokens);
self.capture.to_tokens(tokens);
self.or1_token.to_tokens(tokens);
self.inputs.to_tokens(tokens);
@@ -3382,7 +3410,7 @@ pub(crate) mod printing {
Token![..](Span::call_site()).to_tokens(tokens);
}
self.rest.to_tokens(tokens);
- })
+ });
}
}
@@ -3396,7 +3424,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 37670f22..1c8814d6 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(),
- asyncness: self.asyncness.clone(),
movability: self.movability.clone(),
+ asyncness: self.asyncness.clone(),
capture: self.capture.clone(),
or1_token: self.or1_token.clone(),
inputs: self.inputs.clone(),
@@ -1662,7 +1662,9 @@ 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()),
}
}
@@ -1962,9 +1964,7 @@ 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 3efa2788..11e197ea 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("asyncness", &self.asyncness);
formatter.field("movability", &self.movability);
+ formatter.field("asyncness", &self.asyncness);
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 e6e85323..40fed0b8 100644
--- a/src/gen/eq.rs
+++ b/src/gen/eq.rs
@@ -31,11 +31,8 @@ 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"))]
@@ -59,8 +56,7 @@ 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)
}
}
@@ -151,11 +147,8 @@ 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"))]
@@ -220,11 +213,8 @@ 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"))]
@@ -338,9 +328,7 @@ 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
}
}
@@ -351,7 +339,8 @@ 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")]
@@ -371,9 +360,7 @@ 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
}
}
@@ -384,7 +371,8 @@ 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")]
@@ -434,12 +422,9 @@ 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.asyncness == other.asyncness
- && self.movability == other.movability
- && self.capture == other.capture
- && self.inputs == other.inputs
- && self.output == other.output
+ 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.body == other.body
}
}
@@ -460,7 +445,8 @@ 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")]
@@ -470,11 +456,8 @@ 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")]
@@ -494,8 +477,7 @@ 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
}
@@ -567,10 +549,8 @@ 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
}
}
@@ -601,10 +581,8 @@ 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")]
@@ -614,7 +592,8 @@ 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")]
@@ -644,10 +623,8 @@ 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
}
}
@@ -718,9 +695,7 @@ 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
}
}
@@ -741,11 +716,8 @@ 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")]
@@ -755,10 +727,8 @@ 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")]
@@ -768,10 +738,8 @@ 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"))]
@@ -816,7 +784,8 @@ 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")]
@@ -869,7 +838,8 @@ 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")]
@@ -879,10 +849,8 @@ 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
}
}
@@ -907,12 +875,18 @@ 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,
}
}
@@ -928,9 +902,10 @@ 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,
}
}
@@ -944,7 +919,9 @@ 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,
}
@@ -957,10 +934,8 @@ 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")]
@@ -989,12 +964,9 @@ 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")]
@@ -1004,7 +976,8 @@ 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")]
@@ -1014,10 +987,8 @@ 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
}
}
@@ -1028,12 +999,9 @@ 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")]
@@ -1074,11 +1042,8 @@ 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")]
@@ -1088,11 +1053,8 @@ 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")]
@@ -1102,9 +1064,7 @@ 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
}
}
@@ -1115,9 +1075,7 @@ 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
}
}
@@ -1138,12 +1096,9 @@ 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
}
}
@@ -1154,9 +1109,7 @@ 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
}
}
@@ -1167,9 +1120,7 @@ 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)
}
}
@@ -1180,11 +1131,8 @@ 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")]
@@ -1194,12 +1142,9 @@ 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")]
@@ -1209,11 +1154,8 @@ 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
}
}
@@ -1224,15 +1166,11 @@ 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")]
@@ -1242,11 +1180,8 @@ 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")]
@@ -1256,11 +1191,8 @@ 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")]
@@ -1270,11 +1202,8 @@ 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")]
@@ -1284,10 +1213,8 @@ 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")]
@@ -1307,10 +1234,8 @@ 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")))]
@@ -1370,8 +1295,7 @@ 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)
}
}
@@ -1506,10 +1430,8 @@ 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
}
}
@@ -1540,8 +1462,7 @@ 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
}
}
@@ -1562,9 +1483,7 @@ 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
}
}
@@ -1575,7 +1494,8 @@ 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")]
@@ -1605,10 +1525,8 @@ 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")]
@@ -1670,12 +1588,14 @@ 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,
}
}
@@ -1717,8 +1637,7 @@ 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
}
}
@@ -1729,7 +1648,8 @@ 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")]
@@ -1753,8 +1673,7 @@ 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
}
}
@@ -1779,14 +1698,10 @@ 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
}
}
@@ -1813,10 +1728,8 @@ 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"))]
@@ -1859,9 +1772,7 @@ 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
}
}
@@ -1872,7 +1783,8 @@ 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")]
@@ -1882,10 +1794,8 @@ 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")]
@@ -1895,12 +1805,9 @@ 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"))]
@@ -1949,12 +1856,9 @@ 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"))]
@@ -2014,12 +1918,9 @@ 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"))]
@@ -2030,8 +1931,12 @@ 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,
}
}
@@ -2063,8 +1968,7 @@ 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
}
}
@@ -2075,8 +1979,7 @@ 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
}
}
@@ -2209,10 +2112,8 @@ 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"))]
@@ -2255,7 +2156,9 @@ 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,
}
@@ -2279,8 +2182,12 @@ 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 d9dd32a4..7916a620 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,7 +317,10 @@ 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"))]
@@ -621,7 +624,10 @@ 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")]
@@ -792,10 +798,11 @@ 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")]
@@ -806,15 +813,14 @@ 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"))]
@@ -835,7 +841,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),
@@ -849,12 +855,11 @@ 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),
}
}
@@ -864,47 +869,89 @@ 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)))
}
}
}
@@ -915,7 +962,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),
}
}
@@ -936,9 +983,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"))]
@@ -950,9 +997,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)),
}
}
@@ -963,7 +1010,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)),
}
}
@@ -997,7 +1044,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")]
@@ -1031,7 +1078,9 @@ 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)),
@@ -1040,10 +1089,16 @@ 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)),
@@ -1058,12 +1113,16 @@ 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)),
@@ -1093,7 +1152,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)),
}
}
@@ -1129,7 +1188,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)),
}
}
@@ -1210,12 +1269,13 @@ 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)),
}
@@ -1239,7 +1299,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),
}
}
@@ -1279,12 +1339,11 @@ 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"))]
@@ -1308,7 +1367,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)),
}
}
@@ -1365,7 +1424,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)),
@@ -1413,7 +1472,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)),
@@ -1428,7 +1487,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)),
}
}
@@ -1465,7 +1524,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")]
@@ -1498,7 +1557,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)),
}
}
@@ -1557,7 +1616,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),
}
}
@@ -1569,7 +1628,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)),
}
}
@@ -1581,7 +1640,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),
}
}
@@ -1643,12 +1702,18 @@ 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!(),
}
@@ -1662,7 +1727,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")]
@@ -1673,11 +1738,14 @@ 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,
{
@@ -1687,9 +1755,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")]
@@ -1702,7 +1770,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"))]
@@ -1714,14 +1782,18 @@ 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")]
@@ -1747,11 +1819,15 @@ 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"))]
@@ -1760,9 +1836,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)),
}
}
@@ -1781,10 +1857,16 @@ 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!(),
}
@@ -1797,14 +1879,15 @@ 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")]
@@ -1815,7 +1898,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")]
@@ -1826,7 +1909,8 @@ 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),
}
@@ -1839,13 +1923,14 @@ 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"))]
@@ -1866,9 +1951,13 @@ 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)),
@@ -1876,7 +1965,9 @@ 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)),
@@ -1894,11 +1985,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")]
@@ -1927,13 +2018,12 @@ 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")]
@@ -1967,17 +2057,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)),
@@ -1992,7 +2082,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")]
@@ -2018,13 +2108,12 @@ 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")]
@@ -2038,11 +2127,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")]
@@ -2057,7 +2146,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")]
@@ -2073,8 +2162,11 @@ 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)),
}
@@ -2090,9 +2182,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")]
@@ -2106,9 +2198,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")]
@@ -2134,9 +2226,10 @@ 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")]
@@ -2146,7 +2239,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
@@ -2166,7 +2259,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)),
}
}
@@ -2257,13 +2350,12 @@ 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"))]
@@ -2313,7 +2405,9 @@ 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"))]
@@ -2334,7 +2428,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),
}
}
@@ -2344,10 +2438,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"))]
@@ -2392,7 +2486,9 @@ 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)),
@@ -2420,12 +2516,11 @@ 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")]
@@ -2455,7 +2550,8 @@ 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)),
}
}
@@ -2489,7 +2585,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)),
}
@@ -2558,7 +2654,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)),
}
}
@@ -2578,7 +2674,8 @@ 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)),
}
}
@@ -2590,10 +2687,14 @@ 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),
+ )
}
}
}
@@ -2614,18 +2715,21 @@ 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)),
}
}
@@ -2637,7 +2741,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)),
}
}
@@ -2647,11 +2751,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")]
@@ -2664,7 +2768,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)))
}
}
}
@@ -2675,12 +2779,11 @@ 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)),
}
@@ -2692,10 +2795,12 @@ 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")]
@@ -2732,10 +2837,12 @@ 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"))]
@@ -2751,14 +2858,17 @@ 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)))
}
}
}
@@ -2768,10 +2878,18 @@ 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!(),
}
@@ -2785,15 +2903,11 @@ 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")]
@@ -2804,7 +2918,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")]
@@ -2816,7 +2930,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")]
@@ -2829,15 +2943,11 @@ 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"))]
@@ -2849,7 +2959,9 @@ 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)),
@@ -2858,7 +2970,9 @@ 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!(),
@@ -2872,7 +2986,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),
}
}
@@ -2947,9 +3061,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)),
}
}
@@ -2959,7 +3073,9 @@ 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))
}
@@ -2991,8 +3107,9 @@ 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)),
}
@@ -3003,7 +3120,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)),
@@ -3045,9 +3162,15 @@ 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")]
@@ -3056,7 +3179,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")]
@@ -3085,7 +3208,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)),
}
}
@@ -3120,7 +3243,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"))]
@@ -3132,12 +3255,8 @@ 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"))]
@@ -3176,7 +3295,9 @@ 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))
@@ -3200,10 +3321,14 @@ 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 7247174a..686ed865 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.asyncness.hash(state);
self.movability.hash(state);
+ self.asyncness.hash(state);
self.capture.hash(state);
self.inputs.hash(state);
self.output.hash(state);
@@ -2520,8 +2520,7 @@ 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")))]
@@ -2539,8 +2538,7 @@ 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")))]
@@ -2678,8 +2676,7 @@ 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")))]
@@ -2783,8 +2780,7 @@ 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")))]
@@ -2792,8 +2788,7 @@ 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 24d34b74..d84e4310 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,740 +33,746 @@ 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"))]
@@ -776,19 +782,20 @@ 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();
@@ -805,18 +812,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)
@@ -847,12 +854,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"))]
@@ -963,7 +970,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"))]
@@ -988,18 +995,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)
@@ -1056,8 +1063,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)
@@ -1073,7 +1080,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);
@@ -1215,7 +1222,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) {
@@ -1232,7 +1239,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);
@@ -1244,7 +1251,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);
@@ -1256,12 +1263,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")]
@@ -1270,7 +1277,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);
@@ -1282,7 +1289,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);
@@ -1294,11 +1301,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")]
@@ -1307,7 +1314,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);
@@ -1318,15 +1325,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)
@@ -1334,7 +1341,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);
@@ -1352,7 +1359,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);
@@ -1364,17 +1371,17 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it)
+ v.visit_attribute(it);
}
- if let Some(it) = &node.asyncness {
- tokens_helper(v, &it.span)
- };
if let Some(it) = &node.movability {
- tokens_helper(v, &it.span)
- };
+ tokens_helper(v, &it.span);
+ }
+ if let Some(it) = &node.asyncness {
+ 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();
@@ -1393,12 +1400,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)
@@ -1406,7 +1413,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);
@@ -1418,11 +1425,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);
@@ -1435,7 +1442,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);
@@ -1446,7 +1453,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);
@@ -1454,7 +1461,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)
@@ -1462,7 +1469,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);
@@ -1474,7 +1481,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);
@@ -1487,7 +1494,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it)
+ v.visit_attribute(it);
}
v.visit_lit(&node.lit);
}
@@ -1497,11 +1504,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);
}
@@ -1511,7 +1518,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it)
+ v.visit_attribute(it);
}
v.visit_macro(&node.mac);
}
@@ -1521,13 +1528,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")]
@@ -1536,14 +1543,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();
@@ -1559,7 +1566,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);
@@ -1570,11 +1577,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")]
@@ -1583,15 +1590,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)
@@ -1599,12 +1606,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")]
@@ -1613,7 +1620,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);
@@ -1626,12 +1633,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)
@@ -1639,7 +1646,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);
@@ -1651,11 +1658,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)
@@ -1663,7 +1670,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);
@@ -1674,7 +1681,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);
@@ -1685,7 +1692,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) {
@@ -1702,7 +1709,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);
@@ -1714,7 +1721,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);
@@ -1725,7 +1732,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);
@@ -1736,11 +1743,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);
@@ -1751,12 +1758,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)
@@ -1764,15 +1771,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")]
@@ -1781,12 +1788,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")]
@@ -1795,12 +1802,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"))]
@@ -1853,10 +1860,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")]
@@ -1903,7 +1910,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);
@@ -1915,12 +1922,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)
@@ -1928,13 +1935,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);
@@ -1946,7 +1953,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);
@@ -1977,7 +1984,10 @@ 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,
{
@@ -2013,8 +2023,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);
@@ -2023,11 +2033,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
@@ -2065,12 +2075,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);
@@ -2085,12 +2095,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)
@@ -2098,12 +2108,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);
}
@@ -2113,12 +2123,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);
@@ -2200,7 +2210,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);
@@ -2217,7 +2227,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);
@@ -2238,7 +2248,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);
@@ -2247,7 +2257,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")]
@@ -2256,7 +2266,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);
@@ -2268,12 +2278,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")]
@@ -2282,27 +2292,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")]
@@ -2311,15 +2321,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)
@@ -2327,7 +2337,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);
@@ -2340,7 +2350,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);
@@ -2348,12 +2358,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)
@@ -2361,13 +2371,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);
@@ -2381,7 +2391,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);
@@ -2389,8 +2399,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)
@@ -2398,21 +2408,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);
@@ -2422,7 +2432,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")]
@@ -2431,7 +2441,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);
@@ -2453,7 +2463,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);
@@ -2469,7 +2479,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);
@@ -2483,13 +2493,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);
}
@@ -2514,12 +2524,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);
@@ -2569,47 +2579,41 @@ 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"))]
@@ -2728,7 +2732,8 @@ 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);
@@ -2804,7 +2809,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);
@@ -2815,19 +2820,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)
@@ -2835,7 +2840,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it)
+ v.visit_attribute(it);
}
v.visit_expr(&*node.expr);
}
@@ -2845,7 +2850,7 @@ where
V: Visit<'ast> + ?Sized,
{
for it in &node.attrs {
- v.visit_attribute(it)
+ v.visit_attribute(it);
}
v.visit_macro(&node.mac);
}
@@ -2855,11 +2860,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);
@@ -2874,11 +2879,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")]
@@ -2887,7 +2892,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);
@@ -2899,12 +2904,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")]
@@ -2913,7 +2918,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);
}
@@ -2923,7 +2928,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) {
@@ -2940,7 +2945,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);
@@ -2952,8 +2957,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)
@@ -2961,7 +2966,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) {
@@ -2978,7 +2983,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);
@@ -2989,7 +2994,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);
@@ -3001,7 +3006,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);
}
@@ -3011,8 +3016,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);
@@ -3074,8 +3079,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) {
@@ -3095,8 +3100,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")]
@@ -3119,17 +3124,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"))]
@@ -3151,17 +3156,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);
@@ -3174,15 +3179,14 @@ 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
@@ -3210,12 +3214,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"))]
@@ -3260,7 +3264,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);
@@ -3269,7 +3273,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")]
@@ -3278,12 +3282,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)
@@ -3291,15 +3295,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)
@@ -3307,14 +3311,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);
@@ -3325,7 +3329,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"))]
@@ -3398,14 +3402,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) {
@@ -3416,8 +3420,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"))]
@@ -3469,12 +3473,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);
@@ -3483,11 +3487,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)
@@ -3517,8 +3521,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"))]
@@ -3528,11 +3532,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"))]
@@ -3542,11 +3546,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"))]
@@ -3563,8 +3567,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);
@@ -3679,7 +3683,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);
}
@@ -3689,14 +3693,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)
@@ -3720,8 +3724,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 5ce11f0b..51e10b60 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,743 +34,746 @@ 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"))]
@@ -780,19 +783,20 @@ 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();
@@ -809,18 +813,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)
@@ -851,12 +855,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"))]
@@ -967,7 +971,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"))]
@@ -992,18 +996,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)
@@ -1060,8 +1064,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)
@@ -1077,7 +1081,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);
@@ -1219,7 +1223,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) {
@@ -1236,7 +1240,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);
@@ -1248,7 +1252,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);
@@ -1260,12 +1264,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")]
@@ -1274,7 +1278,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);
@@ -1286,7 +1290,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);
@@ -1298,11 +1302,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")]
@@ -1311,7 +1315,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);
@@ -1322,15 +1326,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)
@@ -1338,7 +1342,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);
@@ -1356,7 +1360,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);
@@ -1368,17 +1372,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.asyncness {
- tokens_helper(v, &mut it.span)
- };
if let Some(it) = &mut node.movability {
- 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);
+ }
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();
@@ -1397,12 +1401,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)
@@ -1410,7 +1414,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);
@@ -1422,11 +1426,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);
@@ -1439,7 +1443,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);
@@ -1450,7 +1454,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);
@@ -1458,7 +1462,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)
@@ -1466,7 +1470,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);
@@ -1478,7 +1482,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);
@@ -1491,7 +1495,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);
}
@@ -1501,11 +1505,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);
}
@@ -1515,7 +1519,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);
}
@@ -1525,13 +1529,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")]
@@ -1540,14 +1544,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();
@@ -1563,7 +1567,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);
@@ -1574,11 +1578,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")]
@@ -1587,15 +1591,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)
@@ -1603,12 +1607,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")]
@@ -1617,7 +1621,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);
@@ -1630,12 +1634,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)
@@ -1643,7 +1647,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);
@@ -1655,11 +1659,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)
@@ -1667,7 +1671,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);
@@ -1678,7 +1682,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);
@@ -1689,7 +1693,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) {
@@ -1706,7 +1710,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);
@@ -1718,7 +1722,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);
@@ -1729,7 +1733,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);
@@ -1740,11 +1744,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);
@@ -1755,12 +1759,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)
@@ -1768,15 +1772,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")]
@@ -1785,12 +1789,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")]
@@ -1799,12 +1803,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"))]
@@ -1857,10 +1861,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")]
@@ -1907,7 +1911,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);
@@ -1919,12 +1923,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)
@@ -1932,13 +1936,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);
@@ -1950,7 +1954,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);
@@ -2017,8 +2021,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);
@@ -2027,11 +2031,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
@@ -2071,12 +2075,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);
@@ -2091,12 +2095,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)
@@ -2104,12 +2108,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);
}
@@ -2119,12 +2123,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);
@@ -2206,7 +2210,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);
@@ -2223,7 +2227,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);
@@ -2244,7 +2248,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);
@@ -2253,7 +2257,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")]
@@ -2262,7 +2266,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);
@@ -2274,12 +2278,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")]
@@ -2288,27 +2292,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")]
@@ -2317,15 +2321,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)
@@ -2333,7 +2337,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);
@@ -2346,7 +2350,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);
@@ -2354,12 +2358,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)
@@ -2367,13 +2371,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);
@@ -2387,7 +2391,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);
@@ -2395,8 +2399,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)
@@ -2404,21 +2408,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);
@@ -2428,7 +2432,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")]
@@ -2437,7 +2441,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);
@@ -2459,7 +2463,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);
@@ -2475,7 +2479,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);
@@ -2489,13 +2493,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);
}
@@ -2520,12 +2524,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);
@@ -2575,47 +2579,41 @@ 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"))]
@@ -2734,7 +2732,8 @@ 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);
@@ -2810,7 +2809,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);
@@ -2821,19 +2820,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)
@@ -2841,7 +2840,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);
}
@@ -2851,7 +2850,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);
}
@@ -2861,11 +2860,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);
@@ -2880,11 +2879,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")]
@@ -2893,7 +2892,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);
@@ -2905,12 +2904,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")]
@@ -2919,7 +2918,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);
}
@@ -2929,7 +2928,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) {
@@ -2946,7 +2945,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);
@@ -2958,8 +2957,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)
@@ -2967,7 +2966,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) {
@@ -2984,7 +2983,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);
@@ -2995,7 +2994,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);
@@ -3007,7 +3006,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);
}
@@ -3017,8 +3016,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);
@@ -3080,8 +3079,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) {
@@ -3101,8 +3100,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")]
@@ -3125,17 +3124,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"))]
@@ -3157,17 +3156,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);
@@ -3180,15 +3179,14 @@ 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
@@ -3216,12 +3214,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"))]
@@ -3266,7 +3264,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);
@@ -3275,7 +3273,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")]
@@ -3284,12 +3282,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)
@@ -3297,15 +3295,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)
@@ -3313,14 +3311,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);
@@ -3331,7 +3329,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"))]
@@ -3404,14 +3402,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) {
@@ -3422,8 +3420,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"))]
@@ -3475,12 +3473,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);
@@ -3489,11 +3487,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)
@@ -3523,8 +3521,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"))]
@@ -3534,11 +3532,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"))]
@@ -3548,11 +3546,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"))]
@@ -3569,8 +3567,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);
@@ -3685,7 +3683,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);
}
@@ -3695,14 +3693,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)
@@ -3726,8 +3724,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 de0772a7..9c2802f8 100644
--- a/src/generics.rs
+++ b/src/generics.rs
@@ -172,17 +172,10 @@ impl Generics {
/// Initializes an empty `where`-clause if there is not one present already.
pub fn make_where_clause(&mut self) -> &mut WhereClause {
- // 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!(),
- }
+ self.where_clause.get_or_insert_with(|| WhereClause {
+ where_token: <Token![where]>::default(),
+ predicates: Punctuated::new(),
+ })
}
}
@@ -777,8 +770,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;
}
@@ -838,15 +831,43 @@ 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) {
- let parenthesized = PathArguments::Parenthesized(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);
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,
@@ -1001,6 +1022,8 @@ 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;
@@ -1195,7 +1218,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() {
@@ -1221,9 +1244,26 @@ 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);
- self.path.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);
+ }
};
match &self.paren_token {
Some(paren) => paren.surround(tokens, to_tokens),
diff --git a/src/item.rs b/src/item.rs
index 10479ab4..917d4f1f 100644
--- a/src/item.rs
+++ b/src/item.rs
@@ -985,7 +985,6 @@ 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")))]
@@ -1100,8 +1099,8 @@ pub mod parsing {
{
input.parse().map(Item::Trait)
} else if lookahead.peek(Token![impl]) {
- let allow_const_impl = true;
- if let Some(item) = parse_impl(input, allow_const_impl)? {
+ let allow_verbatim_impl = true;
+ if let Some(item) = parse_impl(input, allow_verbatim_impl)? {
Ok(Item::Impl(item))
} else {
Ok(Item::Verbatim(verbatim::between(begin, input)))
@@ -1123,8 +1122,6 @@ 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]) {
@@ -1138,8 +1135,8 @@ pub mod parsing {
} else if lookahead.peek(Token![impl])
|| lookahead.peek(Token![default]) && !ahead.peek2(Token![!])
{
- let allow_const_impl = true;
- if let Some(item) = parse_impl(input, allow_const_impl)? {
+ let allow_verbatim_impl = true;
+ if let Some(item) = parse_impl(input, allow_verbatim_impl)? {
Ok(Item::Impl(item))
} else {
Ok(Item::Verbatim(verbatim::between(begin, input)))
@@ -1533,17 +1530,17 @@ pub mod parsing {
fn parse_rest_of_fn(
input: ParseStream,
- outer_attrs: Vec<Attribute>,
+ mut attrs: Vec<Attribute>,
vis: Visibility,
sig: Signature,
) -> Result<ItemFn> {
let content;
let brace_token = braced!(content in input);
- let inner_attrs = content.call(Attribute::parse_inner)?;
+ attr::parsing::parse_inner(&content, &mut attrs)?;
let stmts = content.call(Block::parse_within)?;
Ok(ItemFn {
- attrs: private::attrs(outer_attrs, inner_attrs),
+ attrs,
vis,
sig,
block: Box::new(Block { brace_token, stmts }),
@@ -1669,7 +1666,7 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ItemMod {
fn parse(input: ParseStream) -> Result<Self> {
- let outer_attrs = input.call(Attribute::parse_outer)?;
+ let mut attrs = input.call(Attribute::parse_outer)?;
let vis: Visibility = input.parse()?;
let mod_token: Token![mod] = input.parse()?;
let ident: Ident = input.parse()?;
@@ -1677,7 +1674,7 @@ pub mod parsing {
let lookahead = input.lookahead1();
if lookahead.peek(Token![;]) {
Ok(ItemMod {
- attrs: outer_attrs,
+ attrs,
vis,
mod_token,
ident,
@@ -1687,7 +1684,7 @@ pub mod parsing {
} else if lookahead.peek(token::Brace) {
let content;
let brace_token = braced!(content in input);
- let inner_attrs = content.call(Attribute::parse_inner)?;
+ attr::parsing::parse_inner(&content, &mut attrs)?;
let mut items = Vec::new();
while !content.is_empty() {
@@ -1695,7 +1692,7 @@ pub mod parsing {
}
Ok(ItemMod {
- attrs: private::attrs(outer_attrs, inner_attrs),
+ attrs,
vis,
mod_token,
ident,
@@ -1711,19 +1708,19 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ItemForeignMod {
fn parse(input: ParseStream) -> Result<Self> {
- let outer_attrs = input.call(Attribute::parse_outer)?;
+ let mut attrs = input.call(Attribute::parse_outer)?;
let abi: Abi = input.parse()?;
let content;
let brace_token = braced!(content in input);
- let inner_attrs = content.call(Attribute::parse_inner)?;
+ attr::parsing::parse_inner(&content, &mut attrs)?;
let mut items = Vec::new();
while !content.is_empty() {
items.push(content.parse()?);
}
Ok(ItemForeignMod {
- attrs: private::attrs(outer_attrs, inner_attrs),
+ attrs,
abi,
brace_token,
items,
@@ -1808,7 +1805,7 @@ pub mod parsing {
#[cfg(not(test))]
_ => unreachable!(),
};
- attrs.extend(item_attrs.drain(..));
+ attrs.append(item_attrs);
*item_attrs = attrs;
Ok(item)
@@ -1959,62 +1956,16 @@ 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 attrs = input.call(Attribute::parse_outer)?;
+ let mut 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)?;
+ let (where_clause, fields, semi_token) =
+ derive::parsing::data_struct(input, &mut attrs)?;
Ok(ItemStruct {
attrs,
vis,
@@ -2033,12 +1984,13 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ItemEnum {
fn parse(input: ParseStream) -> Result<Self> {
- let attrs = input.call(Attribute::parse_outer)?;
+ let mut 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)?;
+ let (where_clause, brace_token, variants) =
+ derive::parsing::data_enum(input, &mut attrs)?;
Ok(ItemEnum {
attrs,
vis,
@@ -2057,12 +2009,12 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ItemUnion {
fn parse(input: ParseStream) -> Result<Self> {
- let attrs = input.call(Attribute::parse_outer)?;
+ let mut 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)?;
+ let (where_clause, fields) = derive::parsing::data_union(input, &mut attrs)?;
Ok(ItemUnion {
attrs,
vis,
@@ -2130,7 +2082,7 @@ pub mod parsing {
fn parse_rest_of_trait(
input: ParseStream,
- outer_attrs: Vec<Attribute>,
+ mut attrs: Vec<Attribute>,
vis: Visibility,
unsafety: Option<Token![unsafe]>,
auto_token: Option<Token![auto]>,
@@ -2158,14 +2110,14 @@ pub mod parsing {
let content;
let brace_token = braced!(content in input);
- let inner_attrs = content.call(Attribute::parse_inner)?;
+ attr::parsing::parse_inner(&content, &mut attrs)?;
let mut items = Vec::new();
while !content.is_empty() {
items.push(content.parse()?);
}
Ok(ItemTrait {
- attrs: private::attrs(outer_attrs, inner_attrs),
+ attrs,
vis,
unsafety,
auto_token,
@@ -2291,7 +2243,7 @@ pub mod parsing {
#[cfg(not(test))]
_ => unreachable!(),
};
- attrs.extend(item_attrs.drain(..));
+ attrs.append(item_attrs);
*item_attrs = attrs;
Ok(item)
}
@@ -2330,25 +2282,25 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for TraitItemMethod {
fn parse(input: ParseStream) -> Result<Self> {
- let outer_attrs = input.call(Attribute::parse_outer)?;
+ let mut attrs = input.call(Attribute::parse_outer)?;
let sig: Signature = input.parse()?;
let lookahead = input.lookahead1();
- let (brace_token, inner_attrs, stmts, semi_token) = if lookahead.peek(token::Brace) {
+ let (brace_token, stmts, semi_token) = if lookahead.peek(token::Brace) {
let content;
let brace_token = braced!(content in input);
- let inner_attrs = content.call(Attribute::parse_inner)?;
+ attr::parsing::parse_inner(&content, &mut attrs)?;
let stmts = content.call(Block::parse_within)?;
- (Some(brace_token), inner_attrs, stmts, None)
+ (Some(brace_token), stmts, None)
} else if lookahead.peek(Token![;]) {
let semi_token: Token![;] = input.parse()?;
- (None, Vec::new(), Vec::new(), Some(semi_token))
+ (None, Vec::new(), Some(semi_token))
} else {
return Err(lookahead.error());
};
Ok(TraitItemMethod {
- attrs: private::attrs(outer_attrs, inner_attrs),
+ attrs,
sig,
default: brace_token.map(|brace_token| Block { brace_token, stmts }),
semi_token,
@@ -2449,13 +2401,14 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ItemImpl {
fn parse(input: ParseStream) -> Result<Self> {
- let allow_const_impl = false;
- parse_impl(input, allow_const_impl).map(Option::unwrap)
+ let allow_verbatim_impl = false;
+ parse_impl(input, allow_verbatim_impl).map(Option::unwrap)
}
}
- fn parse_impl(input: ParseStream, allow_const_impl: bool) -> Result<Option<ItemImpl>> {
- let outer_attrs = input.call(Attribute::parse_outer)?;
+ 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();
let defaultness: Option<Token![default]> = input.parse()?;
let unsafety: Option<Token![unsafe]> = input.parse()?;
let impl_token: Token![impl] = input.parse()?;
@@ -2466,7 +2419,8 @@ 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()?
@@ -2474,7 +2428,7 @@ pub mod parsing {
Generics::default()
};
- let is_const_impl = allow_const_impl
+ let is_const_impl = allow_verbatim_impl
&& (input.peek(Token![const]) || input.peek(Token![?]) && input.peek2(Token![const]));
if is_const_impl {
input.parse::<Option<Token![?]>>()?;
@@ -2488,6 +2442,8 @@ 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_;
@@ -2499,15 +2455,20 @@ pub mod parsing {
while let Type::Group(ty) = first_ty_ref {
first_ty_ref = &ty.elem;
}
- if let Type::Path(_) = first_ty_ref {
+ if let Type::Path(TypePath { qself: None, .. }) = 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;
}
@@ -2525,18 +2486,18 @@ pub mod parsing {
let content;
let brace_token = braced!(content in input);
- let inner_attrs = content.call(Attribute::parse_inner)?;
+ attr::parsing::parse_inner(&content, &mut attrs)?;
let mut items = Vec::new();
while !content.is_empty() {
items.push(content.parse()?);
}
- if is_const_impl || is_impl_for && trait_.is_none() {
+ if has_visibility || is_const_impl || is_impl_for && trait_.is_none() {
Ok(None)
} else {
Ok(Some(ItemImpl {
- attrs: private::attrs(outer_attrs, inner_attrs),
+ attrs,
defaultness,
unsafety,
impl_token,
@@ -2598,8 +2559,6 @@ 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)
@@ -2626,7 +2585,7 @@ pub mod parsing {
#[cfg(not(test))]
_ => unreachable!(),
};
- attrs.extend(item_attrs.drain(..));
+ attrs.append(item_attrs);
*item_attrs = attrs;
}
@@ -2676,7 +2635,7 @@ pub mod parsing {
punct.set_span(semi.span);
let tokens = TokenStream::from_iter(vec![TokenTree::Punct(punct)]);
Block {
- brace_token: Brace::default(),
+ brace_token: Brace { span: semi.span },
stmts: vec![Stmt::Item(Item::Verbatim(tokens))],
}
} else {
diff --git a/src/lib.rs b/src/lib.rs
index ea0c6dde..b3efd15b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -250,21 +250,26 @@
//! 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.69")]
+#![doc(html_root_url = "https://docs.rs/syn/1.0.86")]
#![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,
@@ -274,10 +279,14 @@
// 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,
@@ -820,6 +829,7 @@ mod verbatim;
#[cfg(all(any(feature = "full", feature = "derive"), feature = "printing"))]
mod print;
+#[cfg(any(feature = "full", feature = "derive"))]
use crate::__private::private;
////////////////////////////////////////////////////////////////////////////////
@@ -888,6 +898,9 @@ 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 28cd7e36..5dc1753a 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 0aa50a59..bb61ee26 100644
--- a/src/lit.rs
+++ b/src/lit.rs
@@ -3,12 +3,9 @@ use crate::lookahead;
#[cfg(feature = "parsing")]
use crate::parse::{Parse, Parser};
use crate::{Error, Result};
-#[cfg(feature = "printing")]
-use proc_macro2::Ident;
+use proc_macro2::{Ident, Literal, Span};
#[cfg(feature = "parsing")]
-use proc_macro2::TokenStream;
-use proc_macro2::TokenTree;
-use proc_macro2::{Literal, Span};
+use proc_macro2::{TokenStream, TokenTree};
use std::fmt::{self, Display};
#[cfg(feature = "extra-traits")]
use std::hash::{Hash, Hasher};
@@ -40,7 +37,7 @@ ast_enum_of_structs! {
/// A floating point literal: `1f64` or `1.0e10f64`.
///
- /// Must be finite. May not be infinte or NaN.
+ /// Must be finite. May not be infinite or NaN.
Float(LitFloat),
/// A boolean literal: `true` or `false`.
@@ -238,12 +235,16 @@ 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 {
@@ -269,12 +270,16 @@ 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 {
@@ -300,12 +305,16 @@ 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 {
@@ -331,12 +340,16 @@ 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 {
@@ -406,7 +419,11 @@ impl LitInt {
}
pub fn set_span(&mut self, span: Span) {
- self.repr.token.set_span(span)
+ self.repr.token.set_span(span);
+ }
+
+ pub fn token(&self) -> Literal {
+ self.repr.token.clone()
}
}
@@ -478,7 +495,11 @@ impl LitFloat {
}
pub fn set_span(&mut self, span: Span) {
- self.repr.token.set_span(span)
+ self.repr.token.set_span(span);
+ }
+
+ pub fn token(&self) -> Literal {
+ self.repr.token.clone()
}
}
@@ -521,6 +542,11 @@ 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")]
@@ -916,8 +942,7 @@ mod printing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))]
impl ToTokens for LitBool {
fn to_tokens(&self, tokens: &mut TokenStream) {
- let s = if self.value { "true" } else { "false" };
- tokens.append(Ident::new(s, self.span));
+ tokens.append(self.token());
}
}
}
@@ -925,7 +950,6 @@ mod printing {
mod value {
use super::*;
use crate::bigint::BigInt;
- use proc_macro2::TokenStream;
use std::char;
use std::ops::{Index, RangeFrom};
@@ -1437,7 +1461,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, '-');
@@ -1540,35 +1564,37 @@ mod value {
}
}
+ #[allow(clippy::unnecessary_wraps)]
pub fn to_literal(repr: &str, digits: &str, suffix: &str) -> Option<Literal> {
- 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!(),
+ #[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)
+ };
}
}
+ let _ = digits;
+ let _ = suffix;
+ Some(repr.parse::<Literal>().unwrap())
}
}
diff --git a/src/parse_quote.rs b/src/parse_quote.rs
index ec551ef9..8deae4e5 100644
--- a/src/parse_quote.rs
+++ b/src/parse_quote.rs
@@ -58,7 +58,6 @@
/// `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
@@ -66,18 +65,43 @@
/// 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::From::from(
- $crate::__private::quote::quote!($($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)*))
};
}
diff --git a/src/pat.rs b/src/pat.rs
index d25843fc..bfabfe66 100644
--- a/src/pat.rs
+++ b/src/pat.rs
@@ -376,19 +376,7 @@ pub mod parsing {
let begin = input.fork();
let (qself, path) = path::parsing::qpath(input, true)?;
- 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![!=]) {
+ if qself.is_none() && input.peek(Token![!]) && !input.peek(Token![!=]) {
let mut contains_arguments = false;
for segment in &path.segments {
match segment.arguments {
@@ -415,9 +403,19 @@ pub mod parsing {
}
if input.peek(token::Brace) {
- pat_struct(input, path).map(Pat::Struct)
+ let pat = pat_struct(input, path)?;
+ if qself.is_some() {
+ Ok(Pat::Verbatim(verbatim::between(begin, input)))
+ } else {
+ Ok(Pat::Struct(pat))
+ }
} else if input.peek(token::Paren) {
- pat_tuple_struct(input, path).map(Pat::TupleStruct)
+ let pat = pat_tuple_struct(input, path)?;
+ if qself.is_some() {
+ Ok(Pat::Verbatim(verbatim::between(begin, input)))
+ } else {
+ Ok(Pat::TupleStruct(pat))
+ }
} else if input.peek(Token![..]) {
pat_range(input, begin, qself, path)
} else {
diff --git a/src/path.rs b/src/path.rs
index df1788db..48673177 100644
--- a/src/path.rs
+++ b/src/path.rs
@@ -292,6 +292,18 @@ 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")]
{
@@ -577,7 +589,7 @@ pub mod parsing {
path: &mut Self,
expr_style: bool,
) -> Result<()> {
- while input.peek(Token![::]) {
+ while input.peek(Token![::]) && !input.peek3(token::Paren) {
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 f94edc29..5e9a34bd 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, d)| Pair::Punctuated(t, d))
+ self.inner.pop().map(|(t, p)| Pair::Punctuated(t, p))
}
}
@@ -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(_, d) => Some(d),
+ Pair::Punctuated(_, p) => Some(p),
Pair::End(_) => None,
}
}
/// Creates a punctuated pair out of a syntax tree node and an optional
/// following punctuation.
- pub fn new(t: T, d: Option<P>) -> Self {
- match d {
- Some(d) => Pair::Punctuated(t, d),
+ pub fn new(t: T, p: Option<P>) -> Self {
+ match p {
+ Some(p) => Pair::Punctuated(t, p),
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, d) => (t, Some(d)),
+ Pair::Punctuated(t, p) => (t, Some(p)),
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 ba2b22e5..3e2c71bd 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, ParseStream, Result};
+ use crate::parse::{Parse, ParseBuffer, ParseStream, Result};
use proc_macro2::TokenStream;
impl Block {
@@ -152,20 +152,25 @@ 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.peek2(Ident)) {
+ if ahead.peek(Token![!])
+ && (ahead.peek2(token::Brace)
+ && !(ahead.peek3(Token![.]) || ahead.peek3(Token![?]))
+ || ahead.peek2(Ident))
+ {
input.advance_to(&ahead);
return stmt_mac(input, attrs, path);
}
}
if input.peek(Token![let]) {
- stmt_local(input, attrs).map(Stmt::Local)
+ stmt_local(input, attrs, begin)
} else if input.peek(Token![pub])
|| input.peek(Token![crate]) && !input.peek2(Token![::])
|| input.peek(Token![extern])
@@ -180,7 +185,6 @@ 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)
@@ -219,35 +223,49 @@ pub mod parsing {
})))
}
- fn stmt_local(input: ParseStream, attrs: Vec<Attribute>) -> Result<Local> {
- Ok(Local {
+ 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 {
attrs,
- 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()?,
- })
+ let_token,
+ pat,
+ init,
+ semi_token,
+ }))
}
fn stmt_expr(
@@ -258,8 +276,13 @@ pub mod parsing {
let mut e = expr::parsing::expr_early(input)?;
let mut attr_target = &mut e;
- while let Expr::Binary(e) = attr_target {
- attr_target = &mut e.left;
+ 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,
+ };
}
attrs.extend(attr_target.replace_attrs(Vec::new()));
attr_target.replace_attrs(attrs);
diff --git a/src/ty.rs b/src/ty.rs
index b60109f9..c38200f9 100644
--- a/src/ty.rs
+++ b/src/ty.rs
@@ -341,7 +341,6 @@ 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 {
@@ -413,6 +412,7 @@ pub mod parsing {
&& !lookahead.peek(Token![self])
&& !lookahead.peek(Token![Self])
&& !lookahead.peek(Token![crate])
+ || input.peek(Token![dyn])
{
return Err(lookahead.error());
}
@@ -541,15 +541,7 @@ pub mod parsing {
|| lookahead.peek(Token![<])
{
if input.peek(Token![dyn]) {
- 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!(),
- }
- }
+ let trait_object = TypeTraitObject::parse(input, allow_plus)?;
return Ok(Type::TraitObject(trait_object));
}
@@ -594,7 +586,12 @@ pub mod parsing {
if allow_plus {
while input.peek(Token![+]) {
bounds.push_punct(input.parse()?);
- if input.peek(Token![>]) {
+ if !(input.peek(Ident::peek_any)
+ || input.peek(Token![::])
+ || input.peek(Token![?])
+ || input.peek(Lifetime)
+ || input.peek(token::Paren))
+ {
break;
}
bounds.push_value(input.parse()?);
@@ -631,7 +628,7 @@ pub mod parsing {
} else if lookahead.peek(Token![!]) && !input.peek(Token![=]) {
input.parse().map(Type::Never)
} else if lookahead.peek(Token![impl]) {
- input.parse().map(Type::ImplTrait)
+ TypeImplTrait::parse(input, allow_plus).map(Type::ImplTrait)
} else if lookahead.peek(Token![_]) {
input.parse().map(Type::Infer)
} else if lookahead.peek(Lifetime) {
@@ -824,7 +821,10 @@ 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) {
+ 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);
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)
}
- #[doc(hidden)]
- pub fn parse(input: ParseStream, allow_plus: bool) -> Result<Self> {
+ pub(crate) 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,14 +855,16 @@ pub mod parsing {
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ReturnType {
fn parse(input: ParseStream) -> Result<Self> {
- Self::parse(input, true)
+ let allow_plus = true;
+ Self::parse(input, allow_plus)
}
}
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for TypeTraitObject {
fn parse(input: ParseStream) -> Result<Self> {
- Self::parse(input, true)
+ let allow_plus = true;
+ Self::parse(input, allow_plus)
}
}
@@ -876,60 +878,67 @@ 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.
- #[doc(hidden)]
- pub fn parse(input: ParseStream, allow_plus: bool) -> Result<Self> {
+ pub(crate) fn parse(input: ParseStream, allow_plus: bool) -> Result<Self> {
Ok(TypeTraitObject {
dyn_token: input.parse()?,
- 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
- },
+ bounds: Self::parse_bounds(input, allow_plus)?,
})
}
+
+ 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()?,
- // 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
- },
+ bounds: TypeTraitObject::parse_bounds(input, allow_plus)?,
})
}
}
@@ -1009,12 +1018,14 @@ pub mod parsing {
TokenTree::Punct(Punct::new('.', Spacing::Joint)),
TokenTree::Punct(Punct::new('.', Spacing::Alone)),
];
- let tokens = TokenStream::from_iter(args.into_iter().zip(&dot3.spans).map(
- |(mut arg, span)| {
+ let tokens: TokenStream = 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 944d5851..5e3dd443 100644
--- a/tests/common/eq.rs
+++ b/tests/common/eq.rs
@@ -3,26 +3,28 @@ extern crate rustc_data_structures;
extern crate rustc_span;
use rustc_ast::ast::{
- 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,
+ 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,
InlineAsmOperand, InlineAsmOptions, InlineAsmRegOrRegClass, InlineAsmTemplatePiece, IntTy,
- 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,
+ 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,
};
use rustc_ast::ptr::P;
use rustc_ast::token::{self, CommentKind, DelimToken, Nonterminal, Token, TokenKind};
-use rustc_ast::tokenstream::{DelimSpan, LazyTokenStream, TokenStream, TokenTree};
+use rustc_ast::tokenstream::{
+ AttrAnnotatedTokenStream, AttrAnnotatedTokenTree, AttributesData, DelimSpan, LazyTokenStream,
+ Spacing, TokenStream, TokenTree,
+};
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::thin_vec::ThinVec;
use rustc_span::source_map::Spanned;
@@ -33,7 +35,7 @@ pub trait SpanlessEq {
fn eq(&self, other: &Self) -> bool;
}
-impl<T: SpanlessEq> SpanlessEq for Box<T> {
+impl<T: ?Sized + SpanlessEq> SpanlessEq for Box<T> {
fn eq(&self, other: &Self) -> bool {
SpanlessEq::eq(&**self, &**other)
}
@@ -95,6 +97,14 @@ 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 {
@@ -110,6 +120,7 @@ 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) => {
@@ -284,33 +295,32 @@ 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!(AssocTyConstraint; id ident gen_args kind span);
+spanless_eq_struct!(AssocConstraint; id ident gen_args kind span);
+spanless_eq_struct!(AttrAnnotatedTokenStream; 0);
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);
-spanless_eq_struct!(Crate; attrs items span proc_macros);
+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!(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!(FnKind; 0 1 2 3);
+spanless_eq_struct!(Fn; defaultness generics sig body);
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!(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!(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!(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!(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!(Local; pat ty kind 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);
@@ -324,12 +334,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; path fields rest);
+spanless_eq_struct!(StructExpr; qself path fields rest);
spanless_eq_struct!(Token; kind span);
-spanless_eq_struct!(TraitKind; 0 1 2 3 4);
+spanless_eq_struct!(Trait; unsafety is_auto generics bounds items);
spanless_eq_struct!(TraitRef; path ref_id);
spanless_eq_struct!(Ty; id kind span tokens);
-spanless_eq_struct!(TyAliasKind; 0 1 2 3);
+spanless_eq_struct!(TyAlias; defaultness generics bounds ty);
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);
@@ -340,8 +350,9 @@ 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!(AssocTyConstraintKind; Equality(ty) Bound(bounds));
+spanless_eq_enum!(AssocConstraintKind; Equality(term) 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));
@@ -367,7 +378,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!(LlvmAsmDialect; Att Intel);
+spanless_eq_enum!(LocalKind; Decl Init(0) InitElse(0 1));
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);
@@ -379,6 +390,7 @@ 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);
@@ -392,12 +404,11 @@ 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) If(0 1 2) While(0 1 2) ForLoop(0 1 2 3) Loop(0 1) Match(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)
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)
- LlvmInlineAsm(0) MacCall(0) Struct(0) Repeat(0 1) Paren(0) Try(0) Yield(0)
- Err);
+ 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));
@@ -406,7 +417,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) TupleStruct(0 1)
+spanless_eq_enum!(PatKind; Wild Ident(0 1 2) Struct(0 1 2 3) TupleStruct(0 1 2)
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
@@ -513,7 +524,7 @@ impl SpanlessEq for TokenStream {
}
}
-fn doc_comment<'a>(
+fn doc_comment(
style: AttrStyle,
unescaped: Symbol,
trees: &mut impl Iterator<Item = TokenTree>,
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index a1cc80a1..2156530b 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -1,4 +1,5 @@
#![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 1eae327b..a49ee6c9 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.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.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.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.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.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.capture {
#[derive(RefCast)]
@@ -2672,8 +2672,7 @@ 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")?;
@@ -3082,7 +3081,10 @@ 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")?;
@@ -3424,24 +3426,12 @@ 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));
@@ -4202,7 +4192,8 @@ 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)]
@@ -4221,7 +4212,8 @@ 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));
}
@@ -4345,7 +4337,10 @@ 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 cefebace..05de6126 100644
--- a/tests/debug/mod.rs
+++ b/tests/debug/mod.rs
@@ -1,3 +1,10 @@
+#![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 db90818e..86cdb5f6 100644
--- a/tests/macros/mod.rs
+++ b/tests/macros/mod.rs
@@ -39,18 +39,24 @@ 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);
- insta::assert_debug_snapshot!(debug, @$snapshot);
+ if !cfg!(miri) {
+ 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);
- insta::assert_debug_snapshot!(debug, @$snapshot);
+ if !cfg!(miri) {
+ insta::assert_debug_snapshot!(debug, @$snapshot);
+ }
syntax_tree
}};
(($($expr:tt)*) , @$snapshot:literal) => {{
let syntax_tree = $($expr)*;
let debug = crate::macros::debug::Lite(&syntax_tree);
- insta::assert_debug_snapshot!(debug, @$snapshot);
+ if !cfg!(miri) {
+ insta::assert_debug_snapshot!(debug, @$snapshot);
+ }
syntax_tree
}};
(($($expr:tt)*) $next:tt $($rest:tt)*) => {
diff --git a/tests/regression.rs b/tests/regression.rs
new file mode 100644
index 00000000..8311a91b
--- /dev/null
+++ b/tests/regression.rs
@@ -0,0 +1,5 @@
+#![allow(clippy::let_underscore_drop)]
+
+mod regression {
+ automod::dir!("tests/regression");
+}
diff --git a/tests/regression/issue1108.rs b/tests/regression/issue1108.rs
new file mode 100644
index 00000000..11a82ada
--- /dev/null
+++ b/tests/regression/issue1108.rs
@@ -0,0 +1,5 @@
+#[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 24b620c5..79e3018b 100644
--- a/tests/repo/mod.rs
+++ b/tests/repo/mod.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::manual_assert)]
+
mod progress;
use self::progress::Progress;
@@ -8,30 +10,67 @@ use std::path::Path;
use tar::Archive;
use walkdir::DirEntry;
-const REVISION: &str = "52e3dffa50cfffdcfa145c0cc0ba48b49abc0c07";
+const REVISION: &str = "5e57faa78aa7661c6000204591558f6665f11abc";
#[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/closing-args-token.rs",
- "src/test/ui/const-generics/const-expression-parameter.rs",
+ "src/test/ui/const-generics/early/closing-args-token.rs",
+ "src/test/ui/const-generics/early/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/parser/auxiliary/issue-21146-inc.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",
];
pub fn base_dir_filter(entry: &DirEntry) -> bool {
@@ -39,7 +78,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(|e| e != "rs").unwrap_or(true) {
+ if path.extension().map_or(true, |e| e != "rs") {
return false;
}
diff --git a/tests/test_derive_input.rs b/tests/test_derive_input.rs
index bf1ebdb6..93634e57 100644
--- a/tests/test_derive_input.rs
+++ b/tests/test_derive_input.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::too_many_lines)]
+
#[macro_use]
mod macros;
diff --git a/tests/test_expr.rs b/tests/test_expr.rs
index b2b65a25..8c1cc73a 100644
--- a/tests/test_expr.rs
+++ b/tests/test_expr.rs
@@ -300,3 +300,21 @@ 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 b29434a1..330f02f4 100644
--- a/tests/test_generics.rs
+++ b/tests/test_generics.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::too_many_lines)]
+
#[macro_use]
mod macros;
diff --git a/tests/test_item.rs b/tests/test_item.rs
index 712c6c6f..96df4b1a 100644
--- a/tests/test_item.rs
+++ b/tests/test_item.rs
@@ -266,3 +266,71 @@ 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 099daf10..ebe077c6 100644
--- a/tests/test_lit.rs
+++ b/tests/test_lit.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::float_cmp, clippy::non_ascii_literal)]
+
#[macro_use]
mod macros;
@@ -176,7 +178,6 @@ 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) => {
@@ -215,12 +216,6 @@ 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 de6cc4da..9b3f30de 100644
--- a/tests/test_meta.rs
+++ b/tests/test_meta.rs
@@ -1,3 +1,5 @@
+#![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 57a3c7c3..cc23e9ba 100644
--- a/tests/test_parse_buffer.rs
+++ b/tests/test_parse_buffer.rs
@@ -1,3 +1,5 @@
+#![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};
@@ -10,7 +12,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 e05b52ee..c732eff7 100644
--- a/tests/test_path.rs
+++ b/tests/test_path.rs
@@ -102,3 +102,25 @@ 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 3eb2d348..7f8128e6 100644
--- a/tests/test_precedence.rs
+++ b/tests/test_precedence.rs
@@ -1,6 +1,13 @@
#![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:
//!
@@ -128,16 +135,16 @@ fn test_rustc_precedence() {
l_failed
);
- passed.fetch_add(l_passed, Ordering::SeqCst);
- let prev_failed = failed.fetch_add(l_failed, Ordering::SeqCst);
+ passed.fetch_add(l_passed, Ordering::Relaxed);
+ let prev_failed = failed.fetch_add(l_failed, Ordering::Relaxed);
if prev_failed + l_failed >= abort_after {
process::exit(1);
}
});
- let passed = passed.load(Ordering::SeqCst);
- let failed = failed.load(Ordering::SeqCst);
+ let passed = passed.load(Ordering::Relaxed);
+ let failed = failed.load(Ordering::Relaxed);
errorf!("\n===== Precedence Test Results =====\n");
errorf!("{} passed | {} failed\n", passed, failed);
@@ -151,7 +158,7 @@ fn test_expressions(edition: Edition, exprs: Vec<syn::Expr>) -> (usize, usize) {
let mut passed = 0;
let mut failed = 0;
- rustc_span::with_session_globals(edition, || {
+ rustc_span::create_session_if_not_set_then(edition, |_| {
for expr in exprs {
let raw = quote!(#expr).to_string();
@@ -195,10 +202,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::{
- Block, BorrowKind, Expr, ExprField, ExprKind, GenericArg, Pat, Stmt, StmtKind, StructExpr,
- StructRest, Ty,
+ Attribute, Block, BorrowKind, Expr, ExprField, ExprKind, GenericArg, Local, LocalKind, Pat,
+ Stmt, StmtKind, StructExpr, StructRest, Ty,
};
- use rustc_ast::mut_visit::{noop_visit_generic_arg, MutVisitor};
+ use rustc_ast::mut_visit::{noop_visit_generic_arg, noop_visit_local, MutVisitor};
use rustc_data_structures::map_in_place::MapInPlace;
use rustc_data_structures::thin_vec::ThinVec;
use rustc_span::DUMMY_SP;
@@ -240,7 +247,13 @@ 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 { path, fields, rest } = expr.deref_mut();
+ let StructExpr {
+ qself,
+ path,
+ fields,
+ rest,
+ } = expr.deref_mut();
+ vis.visit_qself(qself);
vis.visit_path(path);
fields.flat_map_in_place(|field| flat_map_field(field, vis));
if let StructRest::Base(rest) = rest {
@@ -280,8 +293,12 @@ 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 const generic arg as that's invalid syntax.
- GenericArg::Const(arg) => noop_visit_expr(&mut arg.value, self),
+ // 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);
+ }
+ }
_ => noop_visit_generic_arg(arg, self),
}
}
@@ -294,6 +311,13 @@ 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.
@@ -304,6 +328,10 @@ 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 };
@@ -319,8 +347,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::*;
- use syn::*;
+ use syn::fold::{fold_expr, fold_generic_argument, fold_generic_method_argument, Fold};
+ use syn::{token, Expr, ExprParen, GenericArgument, GenericMethodArgument, Pat, Stmt, Type};
struct ParenthesizeEveryExpr;
impl Fold for ParenthesizeEveryExpr {
@@ -340,8 +368,11 @@ fn syn_brackets(syn_expr: syn::Expr) -> syn::Expr {
fn fold_generic_argument(&mut self, arg: GenericArgument) -> GenericArgument {
match arg {
- // Don't wrap const generic arg as that's invalid syntax.
- GenericArgument::Const(a) => GenericArgument::Const(fold_expr(self, a)),
+ 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,
+ }),
_ => fold_generic_argument(self, arg),
}
}
@@ -351,8 +382,11 @@ fn syn_brackets(syn_expr: syn::Expr) -> syn::Expr {
arg: GenericMethodArgument,
) -> GenericMethodArgument {
match arg {
- // Don't wrap const generic arg as that's invalid syntax.
- GenericMethodArgument::Const(a) => GenericMethodArgument::Const(fold_expr(self, a)),
+ 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,
+ }),
_ => fold_generic_method_argument(self, arg),
}
}
@@ -361,7 +395,13 @@ 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) => Stmt::Semi(fold_expr(self, e), semi),
+ Stmt::Semi(e, semi) => {
+ if let Expr::Verbatim(_) = e {
+ Stmt::Semi(e, semi)
+ } else {
+ Stmt::Semi(fold_expr(self, e), semi)
+ }
+ }
s => s,
}
}
@@ -384,15 +424,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::*;
+ use syn::fold::Fold;
use syn::punctuated::Punctuated;
- use syn::*;
+ use syn::{token, Expr, ExprTuple};
struct CollectExprs(Vec<Expr>);
impl Fold for CollectExprs {
fn fold_expr(&mut self, expr: Expr) -> Expr {
match expr {
- Expr::Verbatim(tokens) if tokens.is_empty() => {}
+ Expr::Verbatim(_) => {}
_ => self.0.push(expr),
}
diff --git a/tests/test_round_trip.rs b/tests/test_round_trip.rs
index e8ed3454..6c1cf222 100644
--- a/tests/test_round_trip.rs
+++ b/tests/test_round_trip.rs
@@ -1,6 +1,8 @@
#![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;
@@ -14,6 +16,7 @@ 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;
@@ -61,7 +64,7 @@ fn test_round_trip() {
}
});
- let failed = failed.load(Ordering::SeqCst);
+ let failed = failed.load(Ordering::Relaxed);
if failed > 0 {
panic!("{} failures", failed);
}
@@ -75,7 +78,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::SeqCst);
+ let prev_failed = failed.fetch_add(1, Ordering::Relaxed);
if prev_failed + 1 >= abort_after {
process::exit(1);
}
@@ -85,7 +88,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::with_session_globals(edition, || {
+ rustc_span::create_session_if_not_set_then(edition, |_| {
let equal = match panic::catch_unwind(|| {
let sess = ParseSess::new(FilePathMapping::empty());
let before = match librustc_parse(content, &sess) {
@@ -144,7 +147,7 @@ fn test(path: &Path, failed: &AtomicUsize, abort_after: usize) {
}
};
if !equal {
- let prev_failed = failed.fetch_add(1, Ordering::SeqCst);
+ let prev_failed = failed.fetch_add(1, Ordering::Relaxed);
if prev_failed + 1 >= abort_after {
process::exit(1);
}
@@ -194,6 +197,12 @@ 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 01e84011..e172df2b 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::*;
+use syn::{Expr, Item, Lit, Pat, Type};
#[test]
fn test_expr_size() {
diff --git a/tests/test_stmt.rs b/tests/test_stmt.rs
index 943d856e..dbe1c765 100644
--- a/tests/test_stmt.rs
+++ b/tests/test_stmt.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::non_ascii_literal)]
+
#[macro_use]
mod macros;
diff --git a/tests/test_ty.rs b/tests/test_ty.rs
index 7e20dd99..a03abaa3 100644
--- a/tests/test_ty.rs
+++ b/tests/test_ty.rs
@@ -217,3 +217,135 @@ 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,
+ },
+ ],
+ },
+ }),
+ ],
+ }
+ "###);
+}