From 4020a8ff408fc15b865dc870477f83f91d708f09 Mon Sep 17 00:00:00 2001 From: ilevyor <81260226+ilevyor@users.noreply.github.com> Date: Thu, 14 Mar 2024 10:56:07 -0400 Subject: [PATCH] Chore: Forbid unused crates (#20) --- Cargo.lock | 9 --------- crates/auth/Cargo.toml | 3 +++ crates/core/src/lib.rs | 10 +++++----- crates/externals/Cargo.toml | 4 +++- crates/gritcache/Cargo.toml | 3 +++ crates/gritmodule/Cargo.toml | 5 +++-- crates/language/Cargo.toml | 6 +++--- crates/lsp/Cargo.toml | 6 +++--- crates/lsp/src/scan.rs | 1 - crates/marzano_messenger/Cargo.toml | 3 +++ crates/test_utils/Cargo.toml | 3 +++ crates/util/Cargo.toml | 7 +++++-- 12 files changed, 34 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 95b604546..746648ea2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1986,7 +1986,6 @@ version = "0.1.0" dependencies = [ "anyhow", "extism", - "log", "serde_json", ] @@ -2010,11 +2009,9 @@ dependencies = [ "reqwest", "serde", "serde_yaml", - "sha2", "tempfile", "tokio", "tree-sitter-facade-sg", - "tree-sitter-gritql", ] [[package]] @@ -2022,15 +2019,12 @@ name = "marzano-language" version = "0.1.0" dependencies = [ "anyhow", - "either", "enum_dispatch", "ignore", - "insta", "itertools 0.10.5", "lazy_static", "marzano-util", "regex", - "serde", "serde_json", "tree-sitter-c-sharp", "tree-sitter-css", @@ -2065,13 +2059,10 @@ dependencies = [ "anyhow", "dashmap", "grit_cache", - "lazy_static", "marzano-core", "marzano-gritmodule", "marzano-language", "marzano-util", - "rayon", - "reqwest", "serde", "serde_json", "tempfile", diff --git a/crates/auth/Cargo.toml b/crates/auth/Cargo.toml index 969015601..873e8170f 100644 --- a/crates/auth/Cargo.toml +++ b/crates/auth/Cargo.toml @@ -3,6 +3,9 @@ name = "marzano-auth" version = "0.1.0" edition = "2021" +[lints] +rust.unused_crate_dependencies = "forbid" + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index b72bf626b..1d428ffb0 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -17,12 +17,12 @@ mod suppress; mod text_unparser; pub mod tree_sitter_serde; -#[cfg(test)] -mod test; - // getrandom is a deeply nested dependency used by many things eg. uuid // to get wasm working we needed to enable a feature for this crate, so // while we don't have a direct usage of it, we had to add it as a dependency // and here we import it to avoid an unused dependency warning -#[cfg(target_arch = "wasm32")] -use getrandom as _; \ No newline at end of file +#[cfg(feature = "wasm_core")] +use getrandom as _; + +#[cfg(test)] +mod test; diff --git a/crates/externals/Cargo.toml b/crates/externals/Cargo.toml index 9ec626036..b804d7e45 100644 --- a/crates/externals/Cargo.toml +++ b/crates/externals/Cargo.toml @@ -3,10 +3,12 @@ name = "marzano-externals" version = "0.1.0" edition = "2021" +[lints] +rust.unused_crate_dependencies = "forbid" + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anyhow = "1.0.70" extism = "^1.0.0-rc7" -log = "0.4.19" serde_json = "1.0.96" diff --git a/crates/gritcache/Cargo.toml b/crates/gritcache/Cargo.toml index b2fdc0d7a..7d850d80a 100644 --- a/crates/gritcache/Cargo.toml +++ b/crates/gritcache/Cargo.toml @@ -3,6 +3,9 @@ name = "grit_cache" version = "0.1.0" edition = "2021" +[lints] +rust.unused_crate_dependencies = "forbid" + [dependencies] marzano-gritmodule = { path = "../gritmodule", features = [ ], default-features = false } diff --git a/crates/gritmodule/Cargo.toml b/crates/gritmodule/Cargo.toml index 0c499eb3d..e36dee845 100644 --- a/crates/gritmodule/Cargo.toml +++ b/crates/gritmodule/Cargo.toml @@ -3,11 +3,13 @@ name = "marzano-gritmodule" version = "0.1.0" edition = "2021" +[lints] +rust.unused_crate_dependencies = "forbid" + [dependencies] marzano-core = { path = "../core", features = [], default-features = true } marzano-language = { path = "../language" } marzano-util = { path = "../util", features = ["finder"] } -tree-sitter-gritql = { path = "../../vendor/tree-sitter-gritql" } tree-sitter = { path = "../../vendor/tree-sitter-facade", package = "tree-sitter-facade-sg" } serde = { version = "1.0.164", features = ["derive"] } serde_yaml = "0.9.25" @@ -23,7 +25,6 @@ tokio = { version = "1", features = ["full"] } tempfile = "3.7.0" log = "0.4.19" reqwest = { version = "0.11.22", features = ["blocking", "json"] } -sha2 = "0.10.8" ignore = "0.4.20" homedir = "0.2.1" diff --git a/crates/language/Cargo.toml b/crates/language/Cargo.toml index 027197318..8002fa7c1 100644 --- a/crates/language/Cargo.toml +++ b/crates/language/Cargo.toml @@ -3,6 +3,9 @@ name = "marzano-language" version = "0.1.0" edition = "2021" +[lints] +rust.unused_crate_dependencies = "forbid" + [dependencies] tree-sitter = { path = "../../vendor/tree-sitter-facade", package = "tree-sitter-facade-sg" } tree-sitter-gritql = { path = "../../vendor/tree-sitter-gritql", optional = true } @@ -24,21 +27,18 @@ tree-sitter-ruby = { path = "../../resources/language-metavariables/tree-sitter- tree-sitter-sql = { path = "../../resources/language-metavariables/tree-sitter-sql", optional = true } tree-sitter-vue = { path = "../../resources/language-metavariables/tree-sitter-vue", optional = true } tree-sitter-toml = { path = "../../resources/language-metavariables/tree-sitter-toml", optional = true } -serde = { version = "1.0.164", features = ["derive"] } serde_json = { version = "1.0.91", features = ["preserve_order"] } marzano-util = { path = "../util" } regex = "1.7.1" anyhow = "1.0.70" itertools = "0.10.5" lazy_static = "1.4.0" -either = "1.8.1" ignore = { version = "0.4.21", optional = true } web-sys = { version = "0.3.66", features = ["console"], optional = true } tree-sitter-traversal = { version = "0.1.2", default-features = false } enum_dispatch = "0.3.12" [dev-dependencies] -insta = "1.26.0" trim-margin = "0.1.0" [features] diff --git a/crates/lsp/Cargo.toml b/crates/lsp/Cargo.toml index f164833d2..ac5078907 100644 --- a/crates/lsp/Cargo.toml +++ b/crates/lsp/Cargo.toml @@ -3,6 +3,9 @@ name = "marzano-lsp" version = "0.1.0" edition = "2021" +[lints] +rust.unused_crate_dependencies = "forbid" + [dependencies] tower-lsp = "0.20.0" tokio = { version = "1", features = ["full"] } @@ -18,10 +21,7 @@ ai_builtins = { git = "https://github.com/getgrit/ai_builtins.git", optional = t marzano-util = { path = "../util", features = ["finder"] } anyhow = "1.0.70" dashmap = "5.5.3" -lazy_static = "1.4.0" uuid = { version = "1.1", features = ["v4", "serde"] } -rayon = "1.8.0" -reqwest = { version = "0.11.22", features = ["blocking", "json"] } tracing = { version = "0.1.40", default-features = false, features = [] } tracing-opentelemetry = { version = "0.22.0", optional = true, default-features = false, features = [] } diff --git a/crates/lsp/src/scan.rs b/crates/lsp/src/scan.rs index 534d82421..0db1ddffb 100644 --- a/crates/lsp/src/scan.rs +++ b/crates/lsp/src/scan.rs @@ -6,7 +6,6 @@ use std::{ use dashmap::{DashMap, DashSet}; use grit_cache::cache::{cache_dir, Cache}; -use rayon::prelude::{IntoParallelRefIterator, ParallelIterator}; use tokio::{runtime::Runtime, task::spawn_blocking}; use tower_lsp::{ lsp_types::{Diagnostic, MessageType, TextDocumentItem, Url}, diff --git a/crates/marzano_messenger/Cargo.toml b/crates/marzano_messenger/Cargo.toml index 723f5aba7..f7d33429c 100644 --- a/crates/marzano_messenger/Cargo.toml +++ b/crates/marzano_messenger/Cargo.toml @@ -3,6 +3,9 @@ name = "marzano_messenger" version = "0.1.0" edition = "2021" +[lints] +rust.unused_crate_dependencies = "forbid" + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/test_utils/Cargo.toml b/crates/test_utils/Cargo.toml index 666c30d26..ba8c5e9cf 100644 --- a/crates/test_utils/Cargo.toml +++ b/crates/test_utils/Cargo.toml @@ -3,6 +3,9 @@ name = "marzano-test-utils" version = "0.1.0" edition = "2021" +[lints] +rust.unused_crate_dependencies = "forbid" + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/util/Cargo.toml b/crates/util/Cargo.toml index 1cb076498..9c9970e5e 100644 --- a/crates/util/Cargo.toml +++ b/crates/util/Cargo.toml @@ -3,6 +3,9 @@ name = "marzano-util" version = "0.1.0" edition = "2021" +[lints] +rust.unused_crate_dependencies = "forbid" + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] @@ -21,14 +24,14 @@ reqwest = { version = "0.11.22", features = [ ], optional = true } tokio = { version = "1.35.1", optional = true } serde_json = "1.0.114" -futures = "0.3.29" +futures = { version = "0.3.29", optional = true} http = "0.2.11" [features] finder = ["log", "ignore"] network_requests_common = [] -network_requests = ["reqwest", "tokio", "tokio/rt", "network_requests_common"] +network_requests = ["dep:futures", "reqwest", "tokio", "tokio/rt", "network_requests_common"] network_requests_external = ["network_requests_common"] external_functions_ffi = []