Skip to content

Commit fc11d8d

Browse files
authored
Update to Rust 2021 edition (mozilla#691)
* lib: Update to Rust 2021 edition * Replace pat with pat_param Following https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html#migration guide * enums: Update to Rust 2021 edition * cli: Update to Rust 2021 edition * web: Update to Rust 2021 edition * Update grammars to Rust 2021 edition
1 parent 2ce9fa2 commit fc11d8d

File tree

11 files changed

+16
-115
lines changed

11 files changed

+16
-115
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "rust-code-analysis"
33
version = "0.0.23"
44
authors = ["Calixte Denizet <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66
repository = "https://github.com/mozilla/rust-code-analysis"
77
documentation = "https://docs.rs/rust-code-analysis/"
88
readme = "README.md"

enums/Cargo.lock

Lines changed: 0 additions & 99 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

enums/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "enums"
33
version = "0.0.1"
44
authors = ["Calixte Denizet <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66

77
[dependencies]
88
enum-iterator = "^0.7"

rust-code-analysis-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "rust-code-analysis-cli"
33
version = "0.0.23"
44
authors = ["Calixte Denizet <[email protected]>"]
55
repository = "https://github.com/mozilla/rust-code-analysis/blob/master/rust-code-analysis-cli/"
6-
edition = "2018"
6+
edition = "2021"
77
keywords = ["metrics"]
88
description = "Tool to compute and export code metrics"
99
license = "MPL-2.0"

rust-code-analysis-web/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "rust-code-analysis-web"
33
version = "0.0.23"
44
authors = ["Calixte Denizet <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66
repository = "https://github.com/mozilla/rust-code-analysis/tree/master/rust-code-analysis-web"
77
keywords = ["metrics"]
88
description = "Run a web service to compute and export code metrics"

src/asttools.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn get_parent<'a>(node: &'a Node<'a>, level: usize) -> Option<Node<'a>> {
1717
}
1818

1919
macro_rules! has_ancestors {
20-
($node:expr, $( $typs:pat )|*, $( $typ:pat ),+) => {{
20+
($node:expr, $( $typs:pat_param )|*, $( $typ:pat_param ),+) => {{
2121
let mut res = false;
2222
loop {
2323
let mut node = *$node;
@@ -54,7 +54,7 @@ macro_rules! has_ancestors {
5454
}
5555

5656
macro_rules! count_specific_ancestors {
57-
($node:expr, $( $typs:pat )|*, $( $stops:pat )|*) => {{
57+
($node:expr, $( $typs:pat_param )|*, $( $stops:pat_param )|*) => {{
5858
let mut count = 0;
5959
let mut node = *$node;
6060
while let Some(parent) = node.object().parent() {

src/metrics/cognitive.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ where
9292
}
9393

9494
macro_rules! compute_booleans {
95-
($node: ident, $stats: ident, $( $typs: pat )|*) => {
95+
($node: ident, $stats: ident, $( $typs: pat_param )|*) => {
9696
let mut cursor = $node.object().walk();
9797
for child in $node.object().children(&mut cursor) {
9898
if let $( $typs )|* = child.kind_id().into() {
@@ -105,9 +105,9 @@ macro_rules! compute_booleans {
105105
}
106106

107107
macro_rules! nesting_levels {
108-
($node: ident, $stats: ident, [$nest_func: pat => $nest_func_stop: pat],
109-
[$lambdas: pat => $( $lambdas_stop: pat )|*],
110-
[$( $nest_level: pat )|* => $( $nest_level_stop: pat )|*]) => {
108+
($node: ident, $stats: ident, [$nest_func: pat_param => $nest_func_stop: pat_param],
109+
[$lambdas: pat => $( $lambdas_stop: pat_param )|*],
110+
[$( $nest_level: pat_param )|* => $( $nest_level_stop: pat_param )|*]) => {
111111
// Find the depth of a function (the most external function is
112112
// not considered)
113113
$stats.nesting = count_specific_ancestors!($node, $nest_func, $nest_func_stop).max(1) - 1;
@@ -129,8 +129,8 @@ macro_rules! nesting_levels {
129129
increment($stats);
130130
};
131131
($node: ident, $stats: ident,
132-
[$lambdas: pat => $( $lambdas_stop: pat )|*],
133-
[$( $nest_level: pat )|* => $( $nest_level_stop: pat )|*]) => {
132+
[$lambdas: pat_param => $( $lambdas_stop: pat_param )|*],
133+
[$( $nest_level: pat_param )|* => $( $nest_level_stop: pat_param )|*]) => {
134134
// Find the depth of a lambda
135135
let lambda_depth = count_specific_ancestors!($node, $lambdas, $( $lambdas_stop )|*);
136136

tree-sitter-ccomment/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ readme = "bindings/rust/README.md"
88
keywords = ["incremental", "parsing", "ccomment"]
99
categories = ["parsing", "text-editors"]
1010
repository = "https://github.com/mozilla/rust-code-analysis"
11-
edition = "2018"
11+
edition = "2021"
1212

1313
build = "bindings/rust/build.rs"
1414
include = [

tree-sitter-mozcpp/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ readme = "bindings/rust/README.md"
88
keywords = ["incremental", "parsing", "mozcpp"]
99
categories = ["parsing", "text-editors"]
1010
repository = "https://github.com/mozilla/rust-code-analysis"
11-
edition = "2018"
11+
edition = "2021"
1212

1313
build = "bindings/rust/build.rs"
1414
include = [

tree-sitter-mozjs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ readme = "bindings/rust/README.md"
88
keywords = ["incremental", "parsing", "mozjs"]
99
categories = ["parsing", "text-editors"]
1010
repository = "https://github.com/mozilla/rust-code-analysis"
11-
edition = "2018"
11+
edition = "2021"
1212

1313
build = "bindings/rust/build.rs"
1414
include = [

tree-sitter-preproc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ readme = "bindings/rust/README.md"
88
keywords = ["incremental", "parsing", "preproc"]
99
categories = ["parsing", "text-editors"]
1010
repository = "https://github.com/mozilla/rust-code-analysis"
11-
edition = "2018"
11+
edition = "2021"
1212

1313
build = "bindings/rust/build.rs"
1414
include = [

0 commit comments

Comments
 (0)