diff --git a/Cargo.lock b/Cargo.lock index 9c280e66..f0f8f34d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -156,9 +156,9 @@ checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cc" -version = "1.1.24" +version = "1.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" dependencies = [ "jobserver", "libc", @@ -565,6 +565,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -651,6 +657,9 @@ name = "hashbrown" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +dependencies = [ + "foldhash", +] [[package]] name = "heck" @@ -982,24 +991,21 @@ dependencies = [ [[package]] name = "object" -version = "0.36.4" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "crc32fast", - "hashbrown 0.14.5", + "hashbrown 0.15.0", "indexmap", "memchr", ] [[package]] name = "once_cell" -version = "1.20.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" -dependencies = [ - "portable-atomic", -] +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "openssl-probe" @@ -1055,12 +1061,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" -[[package]] -name = "portable-atomic" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" - [[package]] name = "postcard" version = "1.0.10" @@ -2349,8 +2349,14 @@ dependencies = [ name = "xtask" version = "0.1.0" dependencies = [ + "anstyle", + "anyhow", + "bindgen", + "cc", + "clap", "git2", "indoc", + "regex", "semver", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 82f99e99..5e7921c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,55 @@ license = "MIT" keywords = ["incremental", "parsing"] categories = ["command-line-utilities", "parsing"] +[workspace.lints.clippy] +dbg_macro = "deny" +todo = "deny" +pedantic = { level = "warn", priority = -1 } +nursery = { level = "warn", priority = -1 } +cargo = { level = "warn", priority = -1 } + +# The lints below are a specific subset of the pedantic+nursery lints +# that we explicitly allow in the tree-sitter codebase because they either: +# +# 1. Contain false positives, +# 2. Are unnecessary, or +# 3. Worsen the code + +branches_sharing_code = "allow" +cast_lossless = "allow" +cast_possible_truncation = "allow" +cast_possible_wrap = "allow" +cast_precision_loss = "allow" +cast_sign_loss = "allow" +checked_conversions = "allow" +cognitive_complexity = "allow" +collection_is_never_read = "allow" +fallible_impl_from = "allow" +fn_params_excessive_bools = "allow" +inline_always = "allow" +if_not_else = "allow" +items_after_statements = "allow" +match_wildcard_for_single_variants = "allow" +missing_errors_doc = "allow" +missing_panics_doc = "allow" +module_name_repetitions = "allow" +multiple_crate_versions = "allow" +option_if_let_else = "allow" +or_fun_call = "allow" +range_plus_one = "allow" +redundant_clone = "allow" +redundant_closure_for_method_calls = "allow" +ref_option = "allow" +similar_names = "allow" +string_lit_as_bytes = "allow" +struct_excessive_bools = "allow" +struct_field_names = "allow" +transmute_undefined_repr = "allow" +too_many_lines = "allow" +unnecessary_wraps = "allow" +unused_self = "allow" +used_underscore_items = "allow" + [profile.optimize] inherits = "release" strip = true # Automatically strip symbols from the binary. diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 37192824..c96dcb78 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -12,6 +12,9 @@ license.workspace = true keywords.workspace = true categories.workspace = true +[lints] +workspace = true + [[bin]] name = "tree-sitter" path = "src/main.rs" diff --git a/cli/config/Cargo.toml b/cli/config/Cargo.toml index 8379a546..5ad7b88f 100644 --- a/cli/config/Cargo.toml +++ b/cli/config/Cargo.toml @@ -12,6 +12,9 @@ license.workspace = true keywords.workspace = true categories.workspace = true +[lints] +workspace = true + [dependencies] anyhow.workspace = true dirs.workspace = true diff --git a/cli/generate/Cargo.toml b/cli/generate/Cargo.toml index b4600343..8f374ae1 100644 --- a/cli/generate/Cargo.toml +++ b/cli/generate/Cargo.toml @@ -12,6 +12,9 @@ license.workspace = true keywords.workspace = true categories.workspace = true +[lints] +workspace = true + [dependencies] anyhow.workspace = true heck.workspace = true diff --git a/cli/loader/Cargo.toml b/cli/loader/Cargo.toml index 65025127..8c5b160b 100644 --- a/cli/loader/Cargo.toml +++ b/cli/loader/Cargo.toml @@ -12,6 +12,9 @@ license.workspace = true keywords.workspace = true categories.workspace = true +[lints] +workspace = true + [features] wasm = ["tree-sitter/wasm"] # TODO: For backward compatibility these must be enabled by default, diff --git a/cli/src/tests/proc_macro/Cargo.toml b/cli/src/tests/proc_macro/Cargo.toml index d25b0cf4..ef991956 100644 --- a/cli/src/tests/proc_macro/Cargo.toml +++ b/cli/src/tests/proc_macro/Cargo.toml @@ -5,6 +5,9 @@ edition.workspace = true rust-version.workspace = true publish = false +[lints] +workspace = true + [lib] proc-macro = true diff --git a/highlight/Cargo.toml b/highlight/Cargo.toml index 1b57fd52..c6f0063c 100644 --- a/highlight/Cargo.toml +++ b/highlight/Cargo.toml @@ -15,6 +15,9 @@ license.workspace = true keywords = ["incremental", "parsing", "syntax", "highlighting"] categories = ["parsing", "text-editors"] +[lints] +workspace = true + [lib] crate-type = ["lib", "staticlib"] diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 3460a537..538b6098 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -25,6 +25,9 @@ include = [ "/include/tree_sitter/api.h", ] +[lints] +workspace = true + [features] default = ["std"] std = ["regex/std", "regex/perf", "regex-syntax/unicode"] diff --git a/lib/language/Cargo.toml b/lib/language/Cargo.toml index 59e5f738..e3d8a6ff 100644 --- a/lib/language/Cargo.toml +++ b/lib/language/Cargo.toml @@ -10,5 +10,8 @@ repository.workspace = true license.workspace = true keywords.workspace = true +[lints] +workspace = true + [lib] path = "language.rs" diff --git a/tags/Cargo.toml b/tags/Cargo.toml index b7d0846c..9db54306 100644 --- a/tags/Cargo.toml +++ b/tags/Cargo.toml @@ -15,6 +15,9 @@ license.workspace = true keywords = ["incremental", "parsing", "syntax", "tagging"] categories = ["parsing", "text-editors"] +[lints] +workspace = true + [lib] crate-type = ["lib", "staticlib"]