build: configure clippy lints at the workspace level

(cherry picked from commit 9c08edb066)
This commit is contained in:
Amaan Qureshi 2024-10-06 13:42:14 -04:00
parent 6c4c522724
commit bb8eb83f50
11 changed files with 98 additions and 16 deletions

38
Cargo.lock generated
View file

@ -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",

View file

@ -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.

View file

@ -12,6 +12,9 @@ license.workspace = true
keywords.workspace = true
categories.workspace = true
[lints]
workspace = true
[[bin]]
name = "tree-sitter"
path = "src/main.rs"

View file

@ -12,6 +12,9 @@ license.workspace = true
keywords.workspace = true
categories.workspace = true
[lints]
workspace = true
[dependencies]
anyhow.workspace = true
dirs.workspace = true

View file

@ -12,6 +12,9 @@ license.workspace = true
keywords.workspace = true
categories.workspace = true
[lints]
workspace = true
[dependencies]
anyhow.workspace = true
heck.workspace = true

View file

@ -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,

View file

@ -5,6 +5,9 @@ edition.workspace = true
rust-version.workspace = true
publish = false
[lints]
workspace = true
[lib]
proc-macro = true

View file

@ -15,6 +15,9 @@ license.workspace = true
keywords = ["incremental", "parsing", "syntax", "highlighting"]
categories = ["parsing", "text-editors"]
[lints]
workspace = true
[lib]
crate-type = ["lib", "staticlib"]

View file

@ -25,6 +25,9 @@ include = [
"/include/tree_sitter/api.h",
]
[lints]
workspace = true
[features]
default = ["std"]
std = ["regex/std", "regex/perf", "regex-syntax/unicode"]

View file

@ -10,5 +10,8 @@ repository.workspace = true
license.workspace = true
keywords.workspace = true
[lints]
workspace = true
[lib]
path = "language.rs"

View file

@ -15,6 +15,9 @@ license.workspace = true
keywords = ["incremental", "parsing", "syntax", "tagging"]
categories = ["parsing", "text-editors"]
[lints]
workspace = true
[lib]
crate-type = ["lib", "staticlib"]