Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Rust 2021 edition #691

Merged
merged 6 commits into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "rust-code-analysis"
version = "0.0.23"
authors = ["Calixte Denizet <cdenizet@mozilla.com>"]
edition = "2018"
edition = "2021"
repository = "https://github.com/mozilla/rust-code-analysis"
documentation = "https://docs.rs/rust-code-analysis/"
readme = "README.md"
Expand Down
99 changes: 0 additions & 99 deletions enums/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion enums/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "enums"
version = "0.0.1"
authors = ["Calixte Denizet <cdenizet@mozilla.com>"]
edition = "2018"
edition = "2021"

[dependencies]
enum-iterator = "^0.7"
Expand Down
2 changes: 1 addition & 1 deletion rust-code-analysis-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "rust-code-analysis-cli"
version = "0.0.23"
authors = ["Calixte Denizet <cdenizet@mozilla.com>"]
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"
Expand Down
2 changes: 1 addition & 1 deletion rust-code-analysis-web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "rust-code-analysis-web"
version = "0.0.23"
authors = ["Calixte Denizet <cdenizet@mozilla.com>"]
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"
Expand Down
4 changes: 2 additions & 2 deletions src/asttools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn get_parent<'a>(node: &'a Node<'a>, level: usize) -> Option<Node<'a>> {
}

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;
Expand Down Expand Up @@ -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() {
Expand Down
12 changes: 6 additions & 6 deletions src/metrics/cognitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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;
Expand All @@ -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 )|*);

Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-ccomment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-mozcpp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-mozjs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-preproc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down