diff --git a/Cargo.toml b/Cargo.toml index 8b25eae6f..9e98bc638 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "rust-code-analysis" version = "0.0.23" authors = ["Calixte Denizet "] -edition = "2018" +edition = "2021" repository = "https://github.com/mozilla/rust-code-analysis" documentation = "https://docs.rs/rust-code-analysis/" readme = "README.md" diff --git a/enums/Cargo.lock b/enums/Cargo.lock index aa84375f5..c91e9b35b 100644 --- a/enums/Cargo.lock +++ b/enums/Cargo.lock @@ -161,7 +161,6 @@ dependencies = [ "askama", "clap", "enum-iterator", - "phf_codegen", "tree-sitter", "tree-sitter-ccomment", "tree-sitter-java", @@ -180,17 +179,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" -[[package]] -name = "getrandom" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "hermit-abi" version = "0.1.18" @@ -259,41 +247,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "phf_codegen" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" -dependencies = [ - "phf_generator", - "phf_shared", -] - -[[package]] -name = "phf_generator" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" -dependencies = [ - "phf_shared", - "rand", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" - [[package]] name = "proc-macro2" version = "1.0.24" @@ -318,46 +271,6 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" -[[package]] -name = "rand" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" -dependencies = [ - "rand_core", -] - [[package]] name = "regex" version = "1.4.5" @@ -401,12 +314,6 @@ dependencies = [ "syn", ] -[[package]] -name = "siphasher" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbce6d4507c7e4a3962091436e56e95290cb71fa302d0d270e32130b75fbff27" - [[package]] name = "static_assertions" version = "1.1.0" @@ -582,12 +489,6 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - [[package]] name = "winapi" version = "0.3.9" diff --git a/enums/Cargo.toml b/enums/Cargo.toml index d97032d82..e004ac0bc 100644 --- a/enums/Cargo.toml +++ b/enums/Cargo.toml @@ -2,7 +2,7 @@ name = "enums" version = "0.0.1" authors = ["Calixte Denizet "] -edition = "2018" +edition = "2021" [dependencies] enum-iterator = "^0.7" diff --git a/rust-code-analysis-cli/Cargo.toml b/rust-code-analysis-cli/Cargo.toml index 2906ddb38..e1f341a3b 100644 --- a/rust-code-analysis-cli/Cargo.toml +++ b/rust-code-analysis-cli/Cargo.toml @@ -3,7 +3,7 @@ name = "rust-code-analysis-cli" version = "0.0.23" authors = ["Calixte Denizet "] repository = "https://github.com/mozilla/rust-code-analysis/blob/master/rust-code-analysis-cli/" -edition = "2018" +edition = "2021" keywords = ["metrics"] description = "Tool to compute and export code metrics" license = "MPL-2.0" diff --git a/rust-code-analysis-web/Cargo.toml b/rust-code-analysis-web/Cargo.toml index 0a3e58ea7..64974bcb2 100644 --- a/rust-code-analysis-web/Cargo.toml +++ b/rust-code-analysis-web/Cargo.toml @@ -2,7 +2,7 @@ name = "rust-code-analysis-web" version = "0.0.23" authors = ["Calixte Denizet "] -edition = "2018" +edition = "2021" repository = "https://github.com/mozilla/rust-code-analysis/tree/master/rust-code-analysis-web" keywords = ["metrics"] description = "Run a web service to compute and export code metrics" diff --git a/src/asttools.rs b/src/asttools.rs index 53a680669..85f7609bc 100644 --- a/src/asttools.rs +++ b/src/asttools.rs @@ -17,7 +17,7 @@ pub fn get_parent<'a>(node: &'a Node<'a>, level: usize) -> Option> { } macro_rules! has_ancestors { - ($node:expr, $( $typs:pat )|*, $( $typ:pat ),+) => {{ + ($node:expr, $( $typs:pat_param )|*, $( $typ:pat_param ),+) => {{ let mut res = false; loop { let mut node = *$node; @@ -54,7 +54,7 @@ macro_rules! has_ancestors { } macro_rules! count_specific_ancestors { - ($node:expr, $( $typs:pat )|*, $( $stops:pat )|*) => {{ + ($node:expr, $( $typs:pat_param )|*, $( $stops:pat_param )|*) => {{ let mut count = 0; let mut node = *$node; while let Some(parent) = node.object().parent() { diff --git a/src/metrics/cognitive.rs b/src/metrics/cognitive.rs index 096c61259..0e7a20f34 100644 --- a/src/metrics/cognitive.rs +++ b/src/metrics/cognitive.rs @@ -92,7 +92,7 @@ where } macro_rules! compute_booleans { - ($node: ident, $stats: ident, $( $typs: pat )|*) => { + ($node: ident, $stats: ident, $( $typs: pat_param )|*) => { let mut cursor = $node.object().walk(); for child in $node.object().children(&mut cursor) { if let $( $typs )|* = child.kind_id().into() { @@ -105,9 +105,9 @@ macro_rules! compute_booleans { } macro_rules! nesting_levels { - ($node: ident, $stats: ident, [$nest_func: pat => $nest_func_stop: pat], - [$lambdas: pat => $( $lambdas_stop: pat )|*], - [$( $nest_level: pat )|* => $( $nest_level_stop: pat )|*]) => { + ($node: ident, $stats: ident, [$nest_func: pat_param => $nest_func_stop: pat_param], + [$lambdas: pat => $( $lambdas_stop: pat_param )|*], + [$( $nest_level: pat_param )|* => $( $nest_level_stop: pat_param )|*]) => { // Find the depth of a function (the most external function is // not considered) $stats.nesting = count_specific_ancestors!($node, $nest_func, $nest_func_stop).max(1) - 1; @@ -129,8 +129,8 @@ macro_rules! nesting_levels { increment($stats); }; ($node: ident, $stats: ident, - [$lambdas: pat => $( $lambdas_stop: pat )|*], - [$( $nest_level: pat )|* => $( $nest_level_stop: pat )|*]) => { + [$lambdas: pat_param => $( $lambdas_stop: pat_param )|*], + [$( $nest_level: pat_param )|* => $( $nest_level_stop: pat_param )|*]) => { // Find the depth of a lambda let lambda_depth = count_specific_ancestors!($node, $lambdas, $( $lambdas_stop )|*); diff --git a/tree-sitter-ccomment/Cargo.toml b/tree-sitter-ccomment/Cargo.toml index 8f604929c..c679e3ab9 100644 --- a/tree-sitter-ccomment/Cargo.toml +++ b/tree-sitter-ccomment/Cargo.toml @@ -8,7 +8,7 @@ readme = "bindings/rust/README.md" keywords = ["incremental", "parsing", "ccomment"] categories = ["parsing", "text-editors"] repository = "https://github.com/mozilla/rust-code-analysis" -edition = "2018" +edition = "2021" build = "bindings/rust/build.rs" include = [ diff --git a/tree-sitter-mozcpp/Cargo.toml b/tree-sitter-mozcpp/Cargo.toml index ab3e78143..1c603b6cc 100644 --- a/tree-sitter-mozcpp/Cargo.toml +++ b/tree-sitter-mozcpp/Cargo.toml @@ -8,7 +8,7 @@ readme = "bindings/rust/README.md" keywords = ["incremental", "parsing", "mozcpp"] categories = ["parsing", "text-editors"] repository = "https://github.com/mozilla/rust-code-analysis" -edition = "2018" +edition = "2021" build = "bindings/rust/build.rs" include = [ diff --git a/tree-sitter-mozjs/Cargo.toml b/tree-sitter-mozjs/Cargo.toml index fb19ce2b7..ab98eb9c5 100644 --- a/tree-sitter-mozjs/Cargo.toml +++ b/tree-sitter-mozjs/Cargo.toml @@ -8,7 +8,7 @@ readme = "bindings/rust/README.md" keywords = ["incremental", "parsing", "mozjs"] categories = ["parsing", "text-editors"] repository = "https://github.com/mozilla/rust-code-analysis" -edition = "2018" +edition = "2021" build = "bindings/rust/build.rs" include = [ diff --git a/tree-sitter-preproc/Cargo.toml b/tree-sitter-preproc/Cargo.toml index d6d781676..7cfeac326 100644 --- a/tree-sitter-preproc/Cargo.toml +++ b/tree-sitter-preproc/Cargo.toml @@ -8,7 +8,7 @@ readme = "bindings/rust/README.md" keywords = ["incremental", "parsing", "preproc"] categories = ["parsing", "text-editors"] repository = "https://github.com/mozilla/rust-code-analysis" -edition = "2018" +edition = "2021" build = "bindings/rust/build.rs" include = [