From 383306e5feaddf71314653a7a39018bbe03e080e Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Sat, 5 Oct 2019 23:40:24 +0900 Subject: [PATCH] Update rustc-ap-* crates to 606.0.0 (#3835) --- Cargo.lock | 229 ++++++++++++++--------------------------- Cargo.toml | 16 ++- src/attr.rs | 8 +- src/chains.rs | 10 +- src/closures.rs | 20 ++-- src/expr.rs | 32 +++--- src/formatting.rs | 18 ++-- src/imports.rs | 2 +- src/items.rs | 36 +++---- src/macros.rs | 2 +- src/matches.rs | 12 +-- src/modules.rs | 8 +- src/modules/visitor.rs | 8 +- src/overflow.rs | 4 +- src/pairs.rs | 6 +- src/patterns.rs | 8 +- src/reorder.rs | 8 +- src/spanned.rs | 2 +- src/stmt.rs | 8 +- src/types.rs | 6 +- src/utils.rs | 14 +-- src/visitor.rs | 10 +- 22 files changed, 202 insertions(+), 265 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 06bead7f25d7..38d97a9c4eb9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,11 +46,6 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "autocfg" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "backtrace" version = "0.3.37" @@ -253,7 +248,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ena" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -413,11 +408,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lock_api" -version = "0.1.5" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -451,14 +445,6 @@ dependencies = [ "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "owning_ref" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "packed_simd" version = "0.3.3" @@ -469,20 +455,23 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parking_lot_core" -version = "0.4.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -535,33 +524,6 @@ dependencies = [ "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_chacha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand_core" version = "0.3.1" @@ -575,32 +537,6 @@ name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand_os" version = "0.1.3" @@ -614,23 +550,6 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_xorshift" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rdrand" version = "0.4.0" @@ -683,33 +602,34 @@ dependencies = [ [[package]] name = "rustc-ap-arena" -version = "583.0.0" +version = "606.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-ap-rustc_data_structures 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-graphviz" -version = "583.0.0" +version = "606.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rustc-ap-rustc_data_structures" -version = "583.0.0" +version = "606.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", - "ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "jobserver 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-graphviz 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-graphviz 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_index 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-rayon-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -719,23 +639,32 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_errors" -version = "583.0.0" +version = "606.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "annotate-snippets 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustc-ap-rustc_index" +version = "606.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-ap-serialize 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc-ap-rustc_lexer" -version = "583.0.0" +version = "606.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -743,7 +672,7 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_macros" -version = "583.0.0" +version = "606.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -755,19 +684,20 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_target" -version = "583.0.0" +version = "606.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_index 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-serialize" -version = "583.0.0" +version = "606.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "indexmap 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -776,33 +706,34 @@ dependencies = [ [[package]] name = "rustc-ap-syntax" -version = "583.0.0" +version = "606.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_errors 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_lexer 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_macros 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_target 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_errors 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_index 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_lexer 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_target 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-syntax_pos" -version = "583.0.0" +version = "606.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-arena 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_macros 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-arena 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_index 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_macros 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -881,9 +812,9 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_target 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_target 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-workspace-hack 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustfmt-config_proc_macro 0.2.0", "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", @@ -919,6 +850,11 @@ name = "scopeguard" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "scopeguard" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "semver" version = "0.9.0" @@ -1177,7 +1113,6 @@ dependencies = [ "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" -"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" "checksum backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "5180c5a20655b14a819b652fd2378fa5f1697b6c9ddad3e695c2f9cedf6df4e2" "checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" @@ -1202,7 +1137,7 @@ dependencies = [ "checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" "checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" "checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" -"checksum ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3dc01d68e08ca384955a3aeba9217102ca1aa85b6e168639bf27739f1d749d87" +"checksum ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8944dc8fa28ce4a38f778bd46bf7d923fe73eed5a439398507246c8e017e6f36" "checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" @@ -1221,48 +1156,41 @@ dependencies = [ "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" -"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +"checksum lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" -"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum packed_simd 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a85ea9fc0d4ac0deb6fe7911d38786b32fc11119afd9e9d38b84ff691ce64220" -"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" -"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" +"checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +"checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" "checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e98a83a9f9b331f54b924e68a66acb1bb35cb01fb0a23645139967abefb697e8" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" "checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d" "checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" "checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" "checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf" -"checksum rustc-ap-arena 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f59b76d334bd533f3fdc5c651c27678c5e80fac67c6f7da22ba21a58878c55f5" -"checksum rustc-ap-graphviz 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e632ef08ca17458acfd46d2ead3d541a1c249586cd5329f5fe333dacfab6142" -"checksum rustc-ap-rustc_data_structures 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e89e2c7be68185418f3cd56af3df8b29007a59a1cebefa63612d055f9bcb1a36" -"checksum rustc-ap-rustc_errors 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1e47cb380abeb72b01e42b2342d592f7eeea7d536c2f1f0d0e550dc509e46333" -"checksum rustc-ap-rustc_lexer 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "494cfaf67f49217d67d0774eeecbba61ac89acf478db97ef11f113ed8a959305" -"checksum rustc-ap-rustc_macros 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2e5d36becc59b4497f9cbd3ae0610081de0207a1d0e95c066369167b14f486f" -"checksum rustc-ap-rustc_target 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7bfc5f96dfc3b9f8d5b57884f7f37467ecff6776cd4b8b491a7daece6fdd7c2" -"checksum rustc-ap-serialize 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2bb9ee231cf79eded39c56647499f83d6136ff5c8c0baaa9e21b6febee00f4f6" -"checksum rustc-ap-syntax 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3827fc208814efbde82d613e31d11b4250ce9e8cf8afe4a4d47bbbd099632c9" -"checksum rustc-ap-syntax_pos 583.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "930ed81c34f325e512cc315c04d676fa84a373879d5c43bb54054a0522b05213" +"checksum rustc-ap-arena 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a623fd4805842e9bd0bb6e6dace63efede0ee22de4522a0b03b7c3d15a22f009" +"checksum rustc-ap-graphviz 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee549ade784b444ef10c0240c3487ed785aa65d711071f7984246b15329a17b6" +"checksum rustc-ap-rustc_data_structures 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca545744a5a9b42e3d0410d6290d40de96dd567253fe77f310c1de4afd213dd4" +"checksum rustc-ap-rustc_errors 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6967a41ed38ef4bce0f559fe9a4801d8ba12ac032f40a12a55e72f79d52c9bb" +"checksum rustc-ap-rustc_index 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "457a5c204ae2fdaa5bdb5b196e58ca59896870d80445fe423063c9453496e3ea" +"checksum rustc-ap-rustc_lexer 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed0c064676f8a08e42a36b0d4e4a102465fb0f4b75e11436cb7f66d2c3fa7139" +"checksum rustc-ap-rustc_macros 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b2d77e46159c5288c585decbcdc9d742889c65e307c31e104c7a36d63fe1f5d0" +"checksum rustc-ap-rustc_target 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "86ca895350b0de14d064b499168c93fa183958d5462eb042c927d93623e41ec1" +"checksum rustc-ap-serialize 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92679240e86f4583cc05f8dcf6439bdab87bac9e6555718469176de9bd52ba20" +"checksum rustc-ap-syntax 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0a0c30f8e38c847dbfd9e2f1e472ab06d0bd0a23ab53ae4c5a44912842ce834e" +"checksum rustc-ap-syntax_pos 606.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdaa0fb40143b4b878256ac4e2b498885daafc269502504d91929eab4744bf4" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d2e07e19601f21c59aad953c2632172ba70cb27e685771514ea66e4062b3363" @@ -1273,6 +1201,7 @@ dependencies = [ "checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" "checksum scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f" diff --git a/Cargo.toml b/Cargo.toml index 26427ed9a5ab..080f1e8ff1fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,9 +47,6 @@ env_logger = "0.6" getopts = "0.2" derive-new = "0.5" cargo_metadata = "0.8" -rustc-ap-rustc_target = "583.0.0" -rustc-ap-syntax = "583.0.0" -rustc-ap-syntax_pos = "583.0.0" failure = "0.1.3" bytecount = "0.6" unicode-width = "0.1.5" @@ -58,7 +55,6 @@ dirs = "2.0.1" ignore = "0.4.6" annotate-snippets = { version = "0.6", features = ["ansi_term"] } structopt = "0.3" - rustfmt-config_proc_macro = { version = "0.2", path = "config_proc_macro" } # A noop dependency that changes in the Rust repository, it's a bit of a hack. @@ -66,5 +62,17 @@ rustfmt-config_proc_macro = { version = "0.2", path = "config_proc_macro" } # for more information. rustc-workspace-hack = "1.0.0" +[dependencies.rustc_target] +package = "rustc-ap-rustc_target" +version = "606.0.0" + +[dependencies.syntax] +package = "rustc-ap-syntax" +version = "606.0.0" + +[dependencies.syntax_pos] +package = "rustc-ap-syntax_pos" +version = "606.0.0" + [dev-dependencies] lazy_static = "1.0.0" diff --git a/src/attr.rs b/src/attr.rs index 7270215ccbbe..63a01e566038 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -20,7 +20,7 @@ mod doc_comment; /// Returns attributes on the given statement. pub(crate) fn get_attrs_from_stmt(stmt: &ast::Stmt) -> &[ast::Attribute] { - match stmt.node { + match stmt.kind { ast::StmtKind::Local(ref local) => &local.attrs, ast::StmtKind::Item(ref item) => &item.attrs, ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => &expr.attrs, @@ -29,7 +29,7 @@ pub(crate) fn get_attrs_from_stmt(stmt: &ast::Stmt) -> &[ast::Attribute] { } pub(crate) fn get_span_without_attrs(stmt: &ast::Stmt) -> Span { - match stmt.node { + match stmt.kind { ast::StmtKind::Local(ref local) => local.span, ast::StmtKind::Item(ref item) => item.span, ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => expr.span, @@ -218,7 +218,7 @@ fn has_newlines_before_after_comment(comment: &str) -> (&str, &str) { impl Rewrite for ast::MetaItem { fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option { - Some(match self.node { + Some(match self.kind { ast::MetaItemKind::Word => { rewrite_path(context, PathContext::Type, None, &self.path, shape)? } @@ -495,7 +495,7 @@ fn attr_prefix(attr: &ast::Attribute) -> &'static str { pub(crate) trait MetaVisitor<'ast> { fn visit_meta_item(&mut self, meta_item: &'ast ast::MetaItem) { - match meta_item.node { + match meta_item.kind { ast::MetaItemKind::Word => self.visit_meta_word(meta_item), ast::MetaItemKind::List(ref list) => self.visit_meta_list(meta_item, list), ast::MetaItemKind::NameValue(ref lit) => self.visit_meta_name_value(meta_item, lit), diff --git a/src/chains.rs b/src/chains.rs index 56775c4b5ef0..ff8d7214c548 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -135,7 +135,7 @@ impl ChainItemKind { } fn is_tup_field_access(expr: &ast::Expr) -> bool { - match expr.node { + match expr.kind { ast::ExprKind::Field(_, ref field) => { field.name.to_string().chars().all(|c| c.is_digit(10)) } @@ -144,7 +144,7 @@ impl ChainItemKind { } fn from_ast(context: &RewriteContext<'_>, expr: &ast::Expr) -> (ChainItemKind, Span) { - let (kind, span) = match expr.node { + let (kind, span) = match expr.kind { ast::ExprKind::MethodCall(ref segment, ref expressions) => { let types = if let Some(ref generic_args) = segment.args { if let ast::GenericArgs::AngleBracketed(ref data) = **generic_args { @@ -262,7 +262,7 @@ impl Chain { let mut rev_children = vec![]; let mut sub_tries = 0; for subexpr in &subexpr_list { - match subexpr.node { + match subexpr.kind { ast::ExprKind::Try(_) => sub_tries += 1, _ => { rev_children.push(ChainItem::new(context, subexpr, sub_tries)); @@ -390,7 +390,7 @@ impl Chain { // Returns the expression's subexpression, if it exists. When the subexpr // is a try! macro, we'll convert it to shorthand when the option is set. fn pop_expr_chain(expr: &ast::Expr, context: &RewriteContext<'_>) -> Option { - match expr.node { + match expr.kind { ast::ExprKind::MethodCall(_, ref expressions) => { Some(Self::convert_try(&expressions[0], context)) } @@ -402,7 +402,7 @@ impl Chain { } fn convert_try(expr: &ast::Expr, context: &RewriteContext<'_>) -> ast::Expr { - match expr.node { + match expr.kind { ast::ExprKind::Mac(ref mac) if context.config.use_try_shorthand() => { if let Some(subexpr) = convert_try_mac(mac, context) { subexpr diff --git a/src/closures.rs b/src/closures.rs index c89ba4c5cdc2..1b877f5ef978 100644 --- a/src/closures.rs +++ b/src/closures.rs @@ -40,7 +40,7 @@ pub(crate) fn rewrite_closure( // 1 = space between `|...|` and body. let body_shape = shape.offset_left(extra_offset)?; - if let ast::ExprKind::Block(ref block, _) = body.node { + if let ast::ExprKind::Block(ref block, _) = body.kind { // The body of the closure is an empty block. if block.stmts.is_empty() && !block_contains_comment(block, context.source_map) { return body @@ -89,7 +89,7 @@ fn get_inner_expr<'a>( prefix: &str, context: &RewriteContext<'_>, ) -> &'a ast::Expr { - if let ast::ExprKind::Block(ref block, _) = expr.node { + if let ast::ExprKind::Block(ref block, _) = expr.kind { if !needs_block(block, prefix, context) { // block.stmts.len() == 1 if let Some(expr) = stmt_expr(&block.stmts[0]) { @@ -110,7 +110,7 @@ fn needs_block(block: &ast::Block, prefix: &str, context: &RewriteContext<'_>) - } fn veto_block(e: &ast::Expr) -> bool { - match e.node { + match e.kind { ast::ExprKind::Call(..) | ast::ExprKind::Binary(..) | ast::ExprKind::Cast(..) @@ -141,7 +141,7 @@ fn rewrite_closure_with_block( let block = ast::Block { stmts: vec![ast::Stmt { id: ast::NodeId::root(), - node: ast::StmtKind::Expr(ptr::P(body.clone())), + kind: ast::StmtKind::Expr(ptr::P(body.clone())), span: body.span, }], id: ast::NodeId::root(), @@ -161,7 +161,7 @@ fn rewrite_closure_expr( shape: Shape, ) -> Option { fn allow_multi_line(expr: &ast::Expr) -> bool { - match expr.node { + match expr.kind { ast::ExprKind::Match(..) | ast::ExprKind::Block(..) | ast::ExprKind::TryBlock(..) @@ -291,9 +291,9 @@ pub(crate) fn rewrite_last_closure( shape: Shape, ) -> Option { if let ast::ExprKind::Closure(capture, ref is_async, movability, ref fn_decl, ref body, _) = - expr.node + expr.kind { - let body = match body.node { + let body = match body.kind { ast::ExprKind::Block(ref block, _) if !is_unsafe_block(block) && !context.inside_macro() @@ -353,7 +353,7 @@ pub(crate) fn rewrite_last_closure( pub(crate) fn args_have_many_closure(args: &[OverflowableItem<'_>]) -> bool { args.iter() .filter_map(OverflowableItem::to_expr) - .filter(|expr| match expr.node { + .filter(|expr| match expr.kind { ast::ExprKind::Closure(..) => true, _ => false, }) @@ -371,7 +371,7 @@ fn is_block_closure_forced(context: &RewriteContext<'_>, expr: &ast::Expr) -> bo } fn is_block_closure_forced_inner(expr: &ast::Expr, version: Version) -> bool { - match expr.node { + match expr.kind { ast::ExprKind::If(..) | ast::ExprKind::While(..) | ast::ExprKind::ForLoop(..) => true, ast::ExprKind::Loop(..) if version == Version::Two => true, ast::ExprKind::AddrOf(_, ref expr) @@ -392,7 +392,7 @@ fn is_block_closure_forced_inner(expr: &ast::Expr, version: Version) -> bool { /// isn't parsed as (if true {...} else {...} | x) | 5 // From https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/classify.rs. fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool { - match e.node { + match e.kind { ast::ExprKind::If(..) | ast::ExprKind::Match(..) | ast::ExprKind::Block(..) diff --git a/src/expr.rs b/src/expr.rs index 93289b582822..86bb98d3ea88 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -65,7 +65,7 @@ pub(crate) fn format_expr( shape }; - let expr_rw = match expr.node { + let expr_rw = match expr.kind { ast::ExprKind::Array(ref expr_vec) => rewrite_array( "", expr_vec.iter(), @@ -250,8 +250,8 @@ pub(crate) fn format_expr( }; fn needs_space_before_range(context: &RewriteContext<'_>, lhs: &ast::Expr) -> bool { - match lhs.node { - ast::ExprKind::Lit(ref lit) => match lit.node { + match lhs.kind { + ast::ExprKind::Lit(ref lit) => match lit.kind { ast::LitKind::FloatUnsuffixed(..) => { context.snippet(lit.span).ends_with('.') } @@ -262,7 +262,7 @@ pub(crate) fn format_expr( } fn needs_space_after_range(rhs: &ast::Expr) -> bool { - match rhs.node { + match rhs.kind { // Don't format `.. ..` into `....`, which is invalid. // // This check is unnecessary for `lhs`, because a range @@ -575,7 +575,7 @@ pub(crate) fn rewrite_cond( expr: &ast::Expr, shape: Shape, ) -> Option { - match expr.node { + match expr.kind { ast::ExprKind::Match(ref cond, _) => { // `match `cond` {` let cond_shape = match context.config.indent_style() { @@ -612,7 +612,7 @@ struct ControlFlow<'a> { } fn extract_pats_and_cond(expr: &ast::Expr) -> (Option<&ast::Pat>, &ast::Expr) { - match expr.node { + match expr.kind { ast::ExprKind::Let(ref pat, ref cond) => (Some(pat), cond), _ => (None, expr), } @@ -620,7 +620,7 @@ fn extract_pats_and_cond(expr: &ast::Expr) -> (Option<&ast::Pat>, &ast::Expr) { // FIXME: Refactor this. fn to_control_flow(expr: &ast::Expr, expr_type: ExprType) -> Option> { - match expr.node { + match expr.kind { ast::ExprKind::If(ref cond, ref if_block, ref else_block) => { let (pat, cond) = extract_pats_and_cond(cond); Some(ControlFlow::new_if( @@ -748,7 +748,7 @@ impl<'a> ControlFlow<'a> { let else_block = self.else_block?; let fixed_cost = self.keyword.len() + " { } else { }".len(); - if let ast::ExprKind::Block(ref else_node, _) = else_block.node { + if let ast::ExprKind::Block(ref else_node, _) = else_block.kind { if !is_simple_block(self.block, None, context.source_map) || !is_simple_block(else_node, None, context.source_map) || pat_expr_str.contains('\n') @@ -1014,7 +1014,7 @@ impl<'a> Rewrite for ControlFlow<'a> { if let Some(else_block) = self.else_block { let shape = Shape::indented(shape.indent, context.config); let mut last_in_chain = false; - let rewrite = match else_block.node { + let rewrite = match else_block.kind { // If the else expression is another if-else expression, prevent it // from being formatted on a single line. // Note how we're passing the original shape, as the @@ -1149,7 +1149,7 @@ pub(crate) fn is_empty_block( } pub(crate) fn stmt_is_expr(stmt: &ast::Stmt) -> bool { - match stmt.node { + match stmt.kind { ast::StmtKind::Expr(..) => true, _ => false, } @@ -1168,7 +1168,7 @@ pub(crate) fn rewrite_literal( l: &ast::Lit, shape: Shape, ) -> Option { - match l.node { + match l.kind { ast::LitKind::Str(_, ast::StrStyle::Cooked) => rewrite_string_lit(context, l.span, shape), _ => wrap_str( context.snippet(l.span).to_owned(), @@ -1253,7 +1253,7 @@ pub(crate) fn rewrite_call( } pub(crate) fn is_simple_expr(expr: &ast::Expr) -> bool { - match expr.node { + match expr.kind { ast::ExprKind::Lit(..) => true, ast::ExprKind::Path(ref qself, ref path) => qself.is_none() && path.segments.len() <= 1, ast::ExprKind::AddrOf(_, ref expr) @@ -1279,7 +1279,7 @@ pub(crate) fn can_be_overflowed_expr( expr: &ast::Expr, args_len: usize, ) -> bool { - match expr.node { + match expr.kind { _ if !expr.attrs.is_empty() => false, ast::ExprKind::Match(..) => { (context.use_block_indent() && args_len == 1) @@ -1324,7 +1324,7 @@ pub(crate) fn can_be_overflowed_expr( } pub(crate) fn is_nested_call(expr: &ast::Expr) -> bool { - match expr.node { + match expr.kind { ast::ExprKind::Call(..) | ast::ExprKind::Mac(..) => true, ast::ExprKind::AddrOf(_, ref expr) | ast::ExprKind::Box(ref expr) @@ -1380,7 +1380,7 @@ fn rewrite_paren( post_comment = rewrite_missing_comment(post_span, shape, context)?; // Remove nested parens if there are no comments. - if let ast::ExprKind::Paren(ref subsubexpr) = subexpr.node { + if let ast::ExprKind::Paren(ref subsubexpr) = subexpr.kind { if remove_nested_parens && pre_comment.is_empty() && post_comment.is_empty() { span = subexpr.span; subexpr = subsubexpr; @@ -1985,7 +1985,7 @@ fn rewrite_expr_addrof( } pub(crate) fn is_method_call(expr: &ast::Expr) -> bool { - match expr.node { + match expr.kind { ast::ExprKind::MethodCall(..) => true, ast::ExprKind::AddrOf(_, ref expr) | ast::ExprKind::Box(ref expr) diff --git a/src/formatting.rs b/src/formatting.rs index b58911705c0a..3635f078e967 100644 --- a/src/formatting.rs +++ b/src/formatting.rs @@ -8,7 +8,7 @@ use std::time::{Duration, Instant}; use syntax::ast; use syntax::errors::emitter::{ColorConfig, Emitter}; -use syntax::errors::{DiagnosticBuilder, Handler}; +use syntax::errors::{Diagnostic, DiagnosticBuilder, Handler}; use syntax::parse::{self, ParseSess}; use syntax::source_map::{FilePathMapping, SourceMap, Span, DUMMY_SP}; @@ -640,12 +640,6 @@ fn parse_crate( .map(|mut parser| { parser.recurse_into_file_modules = false; parser - }) - .map_err(|diags| { - diags - .into_iter() - .map(|d| DiagnosticBuilder::new_diagnostic(&parse_session.span_diagnostic, d)) - .collect::>() }), }; @@ -659,7 +653,13 @@ fn parse_crate( let mut parser = AssertUnwindSafe(parser); catch_unwind(move || parser.0.parse_crate_mod().map_err(|d| vec![d])) } - Err(db) => Ok(Err(db)), + Err(diagnostics) => { + for diagnostic in diagnostics { + parse_session.span_diagnostic.emit_diagnostic(&diagnostic); + } + report.add_parsing_error(); + return Err(ErrorKind::ParseError); + } }; match result { @@ -687,7 +687,7 @@ fn parse_crate( struct SilentEmitter; impl Emitter for SilentEmitter { - fn emit_diagnostic(&mut self, _db: &DiagnosticBuilder<'_>) {} + fn emit_diagnostic(&mut self, _db: &Diagnostic) {} } fn silent_emitter() -> Box { diff --git a/src/imports.rs b/src/imports.rs index 8f6c261cf301..139301f537ad 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -287,7 +287,7 @@ impl UseTree { context: &RewriteContext<'_>, item: &ast::Item, ) -> Option { - match item.node { + match item.kind { ast::ItemKind::Use(ref use_tree) => Some( UseTree::from_ast( context, diff --git a/src/items.rs b/src/items.rs index 053e856b9f19..e10265df0eff 100644 --- a/src/items.rs +++ b/src/items.rs @@ -595,7 +595,7 @@ impl<'a> FmtVisitor<'a> { } } - buffer.sort_by(|(_, a), (_, b)| match (&a.node, &b.node) { + buffer.sort_by(|(_, a), (_, b)| match (&a.kind, &b.kind) { (TyAlias(..), TyAlias(..)) | (Const(..), Const(..)) | (Macro(..), Macro(..)) @@ -616,14 +616,14 @@ impl<'a> FmtVisitor<'a> { // different impl items. if prev_kind .as_ref() - .map_or(false, |prev_kind| need_empty_line(prev_kind, &item.node)) + .map_or(false, |prev_kind| need_empty_line(prev_kind, &item.kind)) { self.push_str("\n"); } let indent_str = self.block_indent.to_string_with_newline(self.config); self.push_str(&indent_str); self.push_str(buf.trim()); - prev_kind = Some(item.node.clone()); + prev_kind = Some(item.kind.clone()); } } else { for item in items { @@ -638,7 +638,7 @@ pub(crate) fn format_impl( item: &ast::Item, offset: Indent, ) -> Option { - if let ast::ItemKind::Impl(_, _, _, ref generics, _, ref self_ty, ref items) = item.node { + if let ast::ItemKind::Impl(_, _, _, ref generics, _, ref self_ty, ref items) = item.kind { let mut result = String::with_capacity(128); let ref_and_type = format_impl_ref_and_type(context, item, offset)?; let sep = offset.to_string_with_newline(context.config); @@ -794,7 +794,7 @@ fn format_impl_ref_and_type( ref trait_ref, ref self_ty, _, - ) = item.node + ) = item.kind { let mut result = String::with_capacity(128); @@ -928,7 +928,7 @@ impl<'a> StructParts<'a> { } pub(crate) fn from_item(item: &'a ast::Item) -> Self { - let (prefix, def, generics) = match item.node { + let (prefix, def, generics) = match item.kind { ast::ItemKind::Struct(ref def, ref generics) => ("struct ", def, generics), ast::ItemKind::Union(ref def, ref generics) => ("union ", def, generics), _ => unreachable!(), @@ -972,7 +972,7 @@ pub(crate) fn format_trait( ref generics, ref generic_bounds, ref trait_items, - ) = item.node + ) = item.kind { let mut result = String::with_capacity(128); let header = format!( @@ -1656,7 +1656,7 @@ pub(crate) struct StaticParts<'a> { impl<'a> StaticParts<'a> { pub(crate) fn from_item(item: &'a ast::Item) -> Self { - let (prefix, ty, mutability, expr) = match item.node { + let (prefix, ty, mutability, expr) = match item.kind { ast::ItemKind::Static(ref ty, mutability, ref expr) => ("static", ty, mutability, expr), ast::ItemKind::Const(ref ty, ref expr) => { ("const", ty, ast::Mutability::Immutable, expr) @@ -1676,7 +1676,7 @@ impl<'a> StaticParts<'a> { } pub(crate) fn from_trait_item(ti: &'a ast::TraitItem) -> Self { - let (ty, expr_opt) = match ti.node { + let (ty, expr_opt) = match ti.kind { ast::TraitItemKind::Const(ref ty, ref expr_opt) => (ty, expr_opt), _ => unreachable!(), }; @@ -1693,7 +1693,7 @@ impl<'a> StaticParts<'a> { } pub(crate) fn from_impl_item(ii: &'a ast::ImplItem) -> Self { - let (ty, expr) = match ii.node { + let (ty, expr) = match ii.kind { ast::ImplItemKind::Const(ref ty, ref expr) => (ty, expr), _ => unreachable!(), }; @@ -1874,7 +1874,7 @@ impl Rewrite for ast::FunctionRetTy { } fn is_empty_infer(ty: &ast::Ty, pat_span: Span) -> bool { - match ty.node { + match ty.kind { ast::TyKind::Infer => ty.span.hi() == pat_span.hi(), _ => false, } @@ -2048,7 +2048,7 @@ pub(crate) fn span_lo_for_param(param: &ast::Param) -> BytePos { } pub(crate) fn span_hi_for_param(context: &RewriteContext<'_>, param: &ast::Param) -> BytePos { - match param.ty.node { + match param.ty.kind { ast::TyKind::Infer if context.snippet(param.ty.span) == "_" => param.ty.span.hi(), ast::TyKind::Infer if is_named_param(param) => param.pat.span.hi(), _ => param.ty.span.hi(), @@ -2056,7 +2056,7 @@ pub(crate) fn span_hi_for_param(context: &RewriteContext<'_>, param: &ast::Param } pub(crate) fn is_named_param(param: &ast::Param) -> bool { - if let ast::PatKind::Ident(_, ident, _) = param.pat.node { + if let ast::PatKind::Ident(_, ident, _) = param.pat.kind { ident.name != symbol::kw::Invalid } else { true @@ -2182,7 +2182,7 @@ fn rewrite_fn_base( indent, param_indent, params_span, - fd.c_variadic, + fd.c_variadic(), )?; let put_params_in_block = match context.config.indent_style() { @@ -3024,7 +3024,7 @@ impl Rewrite for ast::ForeignItem { // FIXME: this may be a faulty span from libsyntax. let span = mk_sp(self.span.lo(), self.span.hi() - BytePos(1)); - let item_str = match self.node { + let item_str = match self.kind { ast::ForeignItemKind::Fn(ref fn_decl, ref generics) => rewrite_fn_base( context, shape.indent, @@ -3146,21 +3146,21 @@ pub(crate) fn rewrite_extern_crate( /// Returns `true` for `mod foo;`, false for `mod foo { .. }`. pub(crate) fn is_mod_decl(item: &ast::Item) -> bool { - match item.node { + match item.kind { ast::ItemKind::Mod(ref m) => m.inner.hi() != item.span.hi(), _ => false, } } pub(crate) fn is_use_item(item: &ast::Item) -> bool { - match item.node { + match item.kind { ast::ItemKind::Use(_) => true, _ => false, } } pub(crate) fn is_extern_crate(item: &ast::Item) -> bool { - match item.node { + match item.kind { ast::ItemKind::ExternCrate(..) => true, _ => false, } diff --git a/src/macros.rs b/src/macros.rs index e92f02a1db1e..8f509dd12c8b 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1196,7 +1196,7 @@ pub(crate) fn convert_try_mac(mac: &ast::Mac, context: &RewriteContext<'_>) -> O Some(ast::Expr { id: ast::NodeId::root(), // dummy value - node: ast::ExprKind::Try(parser.parse_expr().ok()?), + kind: ast::ExprKind::Try(parser.parse_expr().ok()?), span: mac.span, // incorrect span, but shouldn't matter too much attrs: ThinVec::new(), }) diff --git a/src/matches.rs b/src/matches.rs index e8ea5d6ad42b..fcfb8055f018 100644 --- a/src/matches.rs +++ b/src/matches.rs @@ -141,7 +141,7 @@ fn arm_comma(config: &Config, body: &ast::Expr, is_last: bool) -> &'static str { "" } else if config.match_block_trailing_comma() { "," - } else if let ast::ExprKind::Block(ref block, _) = body.node { + } else if let ast::ExprKind::Block(ref block, _) = body.kind { if let ast::BlockCheckMode::Default = block.rules { "" } else { @@ -272,7 +272,7 @@ fn block_can_be_flattened<'a>( context: &RewriteContext<'_>, expr: &'a ast::Expr, ) -> Option<&'a ast::Block> { - match expr.node { + match expr.kind { ast::ExprKind::Block(ref block, _) if !is_unsafe_block(block) && !context.inside_macro() @@ -296,8 +296,8 @@ fn flatten_arm_body<'a>( |expr| !context.config.force_multiline_blocks() && can_flatten_block_around_this(expr); if let Some(ref block) = block_can_be_flattened(context, body) { - if let ast::StmtKind::Expr(ref expr) = block.stmts[0].node { - if let ast::ExprKind::Block(..) = expr.node { + if let ast::StmtKind::Expr(ref expr) = block.stmts[0].kind { + if let ast::ExprKind::Block(..) = expr.kind { flatten_arm_body(context, expr, None) } else { let cond_becomes_muti_line = opt_shape @@ -331,7 +331,7 @@ fn rewrite_match_body( body, shape.offset_left(extra_offset(pats_str, shape) + 4), ); - let (is_block, is_empty_block) = if let ast::ExprKind::Block(ref block, _) = body.node { + let (is_block, is_empty_block) = if let ast::ExprKind::Block(ref block, _) = body.kind { ( true, is_empty_block(block, Some(&body.attrs), context.source_map), @@ -548,7 +548,7 @@ fn nop_block_collapse(block_str: Option, budget: usize) -> Option bool { - match body.node { + match body.kind { // We do not allow `if` to stay on the same line, since we could easily mistake // `pat => if cond { ... }` and `pat if cond => { ... }`. ast::ExprKind::If(..) => false, diff --git a/src/modules.rs b/src/modules.rs index 0c1ea008f687..568faa7194b5 100644 --- a/src/modules.rs +++ b/src/modules.rs @@ -104,7 +104,7 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> { visitor::CfgIfVisitor::new(self.parse_sess, self.directory.to_syntax_directory()); visitor.visit_item(&item); for module_item in visitor.mods() { - if let ast::ItemKind::Mod(ref sub_mod) = module_item.item.node { + if let ast::ItemKind::Mod(ref sub_mod) = module_item.item.kind { self.visit_sub_mod(&module_item.item, Cow::Owned(sub_mod.clone()))?; } } @@ -119,7 +119,7 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> { continue; } - if let ast::ItemKind::Mod(ref sub_mod) = item.node { + if let ast::ItemKind::Mod(ref sub_mod) = item.kind { self.visit_sub_mod(&item, Cow::Owned(sub_mod.clone()))?; } } @@ -133,7 +133,7 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> { self.visit_cfg_if(Cow::Borrowed(item))?; } - if let ast::ItemKind::Mod(ref sub_mod) = item.node { + if let ast::ItemKind::Mod(ref sub_mod) = item.kind { self.visit_sub_mod(item, Cow::Borrowed(sub_mod))?; } } @@ -476,7 +476,7 @@ fn parse_mod_items<'a>(parser: &mut parser::Parser<'a>, inner_lo: Span) -> PResu } fn is_cfg_if(item: &ast::Item) -> bool { - match item.node { + match item.kind { ast::ItemKind::Mac(ref mac) => { if let Some(first_segment) = mac.path.segments.first() { if first_segment.ident.name == Symbol::intern("cfg_if") { diff --git a/src/modules/visitor.rs b/src/modules/visitor.rs index 34b7e3463347..e9223ce96448 100644 --- a/src/modules/visitor.rs +++ b/src/modules/visitor.rs @@ -98,7 +98,7 @@ impl<'a, 'ast: 'a> CfgIfVisitor<'a> { ); } }; - if let ast::ItemKind::Mod(..) = item.node { + if let ast::ItemKind::Mod(..) = item.kind { self.mods.push(ModItem { item }); } } @@ -137,7 +137,7 @@ impl PathVisitor { impl<'ast> MetaVisitor<'ast> for PathVisitor { fn visit_meta_name_value(&mut self, meta_item: &'ast ast::MetaItem, lit: &'ast ast::Lit) { - if meta_item.check_name(Symbol::intern("path")) && lit.node.is_str() { + if meta_item.check_name(Symbol::intern("path")) && lit.kind.is_str() { self.paths.push(lit_to_str(lit)); } } @@ -145,7 +145,7 @@ impl<'ast> MetaVisitor<'ast> for PathVisitor { #[cfg(not(windows))] fn lit_to_str(lit: &ast::Lit) -> String { - match lit.node { + match lit.kind { ast::LitKind::Str(symbol, ..) => symbol.to_string(), _ => unreachable!(), } @@ -153,7 +153,7 @@ fn lit_to_str(lit: &ast::Lit) -> String { #[cfg(windows)] fn lit_to_str(lit: &ast::Lit) -> String { - match lit.node { + match lit.kind { ast::LitKind::Str(symbol, ..) => symbol.as_str().replace("/", "\\"), _ => unreachable!(), } diff --git a/src/overflow.rs b/src/overflow.rs index 7c3f9d1a5eb4..3b85c0b8e575 100644 --- a/src/overflow.rs +++ b/src/overflow.rs @@ -126,7 +126,7 @@ impl<'a> OverflowableItem<'a> { OverflowableItem::MacroArg(MacroArg::Expr(expr)) => is_simple_expr(expr), OverflowableItem::NestedMetaItem(nested_meta_item) => match nested_meta_item { ast::NestedMetaItem::Literal(..) => true, - ast::NestedMetaItem::MetaItem(ref meta_item) => match meta_item.node { + ast::NestedMetaItem::MetaItem(ref meta_item) => match meta_item.kind { ast::MetaItemKind::Word => true, _ => false, }, @@ -399,7 +399,7 @@ impl<'a> Context<'a> { let last_item = self.last_item()?; let rewrite = match last_item { OverflowableItem::Expr(ref expr) => { - match expr.node { + match expr.kind { // When overflowing the closure which consists of a single control flow // expression, force to use block if its condition uses multi line. ast::ExprKind::Closure(..) => { diff --git a/src/pairs.rs b/src/pairs.rs index 49a77c102f6c..45132c1f9f65 100644 --- a/src/pairs.rs +++ b/src/pairs.rs @@ -254,7 +254,7 @@ impl FlattenPair for ast::Expr { context: &RewriteContext<'_>, shape: Shape, ) -> Option> { - let top_op = match self.node { + let top_op = match self.kind { ast::ExprKind::Binary(op, _, _) => op.node, _ => return None, }; @@ -285,7 +285,7 @@ impl FlattenPair for ast::Expr { let mut separators = vec![]; let mut node = self; loop { - match node.node { + match node.kind { ast::ExprKind::Binary(op, ref lhs, _) if op.node == top_op => { stack.push(node); node = lhs; @@ -295,7 +295,7 @@ impl FlattenPair for ast::Expr { let rw = default_rewrite(node, op_len, list.is_empty()); list.push((node, rw)); if let Some(pop) = stack.pop() { - match pop.node { + match pop.kind { ast::ExprKind::Binary(op, _, ref rhs) => { separators.push(op.node.to_string()); node = rhs; diff --git a/src/patterns.rs b/src/patterns.rs index 9a89c8d192c5..e81631d16624 100644 --- a/src/patterns.rs +++ b/src/patterns.rs @@ -36,7 +36,7 @@ pub(crate) fn is_short_pattern(pat: &ast::Pat, pat_str: &str) -> bool { } fn is_short_pattern_inner(pat: &ast::Pat) -> bool { - match pat.node { + match pat.kind { ast::PatKind::Rest | ast::PatKind::Wild | ast::PatKind::Lit(_) => true, ast::PatKind::Ident(_, _, ref pat) => pat.is_none(), ast::PatKind::Struct(..) @@ -57,7 +57,7 @@ fn is_short_pattern_inner(pat: &ast::Pat) -> bool { impl Rewrite for Pat { fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option { - match self.node { + match self.kind { PatKind::Or(ref pats) => { let pat_strs = pats .iter() @@ -335,7 +335,7 @@ impl<'a> Spanned for TuplePatField<'a> { impl<'a> TuplePatField<'a> { fn is_dotdot(&self) -> bool { match self { - TuplePatField::Pat(pat) => match pat.node { + TuplePatField::Pat(pat) => match pat.kind { ast::PatKind::Rest => true, _ => false, }, @@ -350,7 +350,7 @@ pub(crate) fn can_be_overflowed_pat( len: usize, ) -> bool { match *pat { - TuplePatField::Pat(pat) => match pat.node { + TuplePatField::Pat(pat) => match pat.kind { ast::PatKind::Path(..) | ast::PatKind::Tuple(..) | ast::PatKind::Struct(..) diff --git a/src/reorder.rs b/src/reorder.rs index 43a788c63398..5a6a45118b93 100644 --- a/src/reorder.rs +++ b/src/reorder.rs @@ -23,7 +23,7 @@ use crate::visitor::FmtVisitor; /// Choose the ordering between the given two items. fn compare_items(a: &ast::Item, b: &ast::Item) -> Ordering { - match (&a.node, &b.node) { + match (&a.kind, &b.kind) { (&ast::ItemKind::Mod(..), &ast::ItemKind::Mod(..)) => { a.ident.as_str().cmp(&b.ident.as_str()) } @@ -68,7 +68,7 @@ fn rewrite_reorderable_item( item: &ast::Item, shape: Shape, ) -> Option { - match item.node { + match item.kind { ast::ItemKind::ExternCrate(..) => rewrite_extern_crate(context, item, shape), ast::ItemKind::Mod(..) => rewrite_mod(context, item, shape), _ => None, @@ -83,7 +83,7 @@ fn rewrite_reorderable_items( shape: Shape, span: Span, ) -> Option { - match reorderable_items[0].node { + match reorderable_items[0].kind { // FIXME: Remove duplicated code. ast::ItemKind::Use(..) => { let mut normalized_items: Vec<_> = reorderable_items @@ -164,7 +164,7 @@ enum ReorderableItemKind { impl ReorderableItemKind { fn from(item: &ast::Item) -> Self { - match item.node { + match item.kind { _ if contains_macro_use_attr(item) | contains_skip(&item.attrs) => { ReorderableItemKind::Other } diff --git a/src/spanned.rs b/src/spanned.rs index de02b79550ff..8872e6df2da0 100644 --- a/src/spanned.rs +++ b/src/spanned.rs @@ -63,7 +63,7 @@ implement_spanned!(ast::ImplItem); impl Spanned for ast::Stmt { fn span(&self) -> Span { - match self.node { + match self.kind { ast::StmtKind::Local(ref local) => mk_sp(local.span().lo(), self.span.hi()), ast::StmtKind::Item(ref item) => mk_sp(item.span().lo(), self.span.hi()), ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => { diff --git a/src/stmt.rs b/src/stmt.rs index dbda00f00ce9..a7aa6de0b134 100644 --- a/src/stmt.rs +++ b/src/stmt.rs @@ -27,7 +27,7 @@ impl<'a> Stmt<'a> { } pub(crate) fn to_item(&self) -> Option<&ast::Item> { - match self.inner.node { + match self.inner.kind { ast::StmtKind::Item(ref item) => Some(&**item), _ => None, } @@ -57,8 +57,8 @@ impl<'a> Stmt<'a> { return false; } - match self.as_ast_node().node { - ast::StmtKind::Expr(ref expr) => match expr.node { + match self.as_ast_node().kind { + ast::StmtKind::Expr(ref expr) => match expr.kind { ast::ExprKind::Ret(..) | ast::ExprKind::Continue(..) | ast::ExprKind::Break(..) => { false } @@ -94,7 +94,7 @@ fn format_stmt( ) -> Option { skip_out_of_file_lines_range!(context, stmt.span()); - let result = match stmt.node { + let result = match stmt.kind { ast::StmtKind::Local(ref local) => local.rewrite(context, shape), ast::StmtKind::Expr(ref ex) | ast::StmtKind::Semi(ref ex) => { let suffix = if semicolon_for_stmt(context, stmt) { diff --git a/src/types.rs b/src/types.rs index 012cdba3192b..3efe80fdb81c 100644 --- a/src/types.rs +++ b/src/types.rs @@ -613,7 +613,7 @@ impl Rewrite for ast::TraitRef { impl Rewrite for ast::Ty { fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option { - match self.node { + match self.kind { ast::TyKind::TraitObject(ref bounds, tobj_syntax) => { // we have to consider 'dyn' keyword is used or not!!! let is_dyn = tobj_syntax == ast::TraitObjectSyntax::Dyn; @@ -800,7 +800,7 @@ fn rewrite_bare_fn( let rewrite = format_function_type( bare_fn.decl.inputs.iter(), &bare_fn.decl.output, - bare_fn.decl.c_variadic, + bare_fn.decl.c_variadic(), span, context, func_ty_shape, @@ -891,7 +891,7 @@ pub(crate) fn can_be_overflowed_type( ty: &ast::Ty, len: usize, ) -> bool { - match ty.node { + match ty.kind { ast::TyKind::Tup(..) => context.use_block_indent() && len == 1, ast::TyKind::Rptr(_, ref mutty) | ast::TyKind::Ptr(ref mutty) => { can_be_overflowed_type(context, &*mutty.ty, len) diff --git a/src/utils.rs b/src/utils.rs index 76af95a8c7f4..12e3d943417d 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -248,7 +248,7 @@ pub(crate) fn last_line_extendable(s: &str) -> bool { #[inline] fn is_skip(meta_item: &MetaItem) -> bool { - match meta_item.node { + match meta_item.kind { MetaItemKind::Word => { let path_str = meta_item.path.to_string(); path_str == skip_annotation().as_str() || path_str == depr_skip_annotation().as_str() @@ -277,7 +277,7 @@ pub(crate) fn contains_skip(attrs: &[Attribute]) -> bool { #[inline] pub(crate) fn semicolon_for_expr(context: &RewriteContext<'_>, expr: &ast::Expr) -> bool { - match expr.node { + match expr.kind { ast::ExprKind::Ret(..) | ast::ExprKind::Continue(..) | ast::ExprKind::Break(..) => { context.config.trailing_semicolon() } @@ -287,8 +287,8 @@ pub(crate) fn semicolon_for_expr(context: &RewriteContext<'_>, expr: &ast::Expr) #[inline] pub(crate) fn semicolon_for_stmt(context: &RewriteContext<'_>, stmt: &ast::Stmt) -> bool { - match stmt.node { - ast::StmtKind::Semi(ref expr) => match expr.node { + match stmt.kind { + ast::StmtKind::Semi(ref expr) => match expr.kind { ast::ExprKind::While(..) | ast::ExprKind::Loop(..) | ast::ExprKind::ForLoop(..) => { false } @@ -304,7 +304,7 @@ pub(crate) fn semicolon_for_stmt(context: &RewriteContext<'_>, stmt: &ast::Stmt) #[inline] pub(crate) fn stmt_expr(stmt: &ast::Stmt) -> Option<&ast::Expr> { - match stmt.node { + match stmt.kind { ast::StmtKind::Expr(ref expr) => Some(expr), _ => None, } @@ -422,7 +422,7 @@ pub(crate) fn colon_spaces(config: &Config) -> &'static str { #[inline] pub(crate) fn left_most_sub_expr(e: &ast::Expr) -> &ast::Expr { - match e.node { + match e.kind { ast::ExprKind::Call(ref e, _) | ast::ExprKind::Binary(_, ref e, _) | ast::ExprKind::Cast(ref e, _) @@ -450,7 +450,7 @@ pub(crate) fn first_line_ends_with(s: &str, c: char) -> bool { // States whether an expression's last line exclusively consists of closing // parens, braces, and brackets in its idiomatic formatting. pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr: &str) -> bool { - match expr.node { + match expr.kind { ast::ExprKind::Mac(..) | ast::ExprKind::Call(..) | ast::ExprKind::MethodCall(..) diff --git a/src/visitor.rs b/src/visitor.rs index 8a1b3cd71fe7..15490798a6e6 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -112,7 +112,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { return; } - match stmt.as_ast_node().node { + match stmt.as_ast_node().kind { ast::StmtKind::Item(ref item) => { self.visit_item(item); // Handle potential `;` after the item. @@ -397,7 +397,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { let skip_context_saved = self.skip_context.clone(); self.skip_context.update_with_attrs(&attrs); - let should_visit_node_again = match item.node { + let should_visit_node_again = match item.kind { // For use/extern crate items, skip rewriting attributes but check for a skip attribute. ast::ItemKind::Use(..) | ast::ItemKind::ExternCrate(_) => { if contains_skip(attrs) { @@ -439,7 +439,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { }; if should_visit_node_again { - match item.node { + match item.kind { ast::ItemKind::Use(ref tree) => self.format_import(item, tree), ast::ItemKind::Impl(..) => { let block_indent = self.block_indent; @@ -557,7 +557,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { return; } - match ti.node { + match ti.kind { ast::TraitItemKind::Const(..) => self.visit_static(&StaticParts::from_trait_item(ti)), ast::TraitItemKind::Method(ref sig, None) => { let indent = self.block_indent; @@ -601,7 +601,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { return; } - match ii.node { + match ii.kind { ast::ImplItemKind::Method(ref sig, ref body) => { let inner_attrs = inner_attributes(&ii.attrs); self.visit_fn(