From 0fba343844e21c19fd2fcbfe3eb8818aed714af9 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Tue, 11 Jun 2024 15:47:54 +0200 Subject: [PATCH] Add red_knot feature --- crates/ruff_python_semantic/Cargo.toml | 9 ++++++--- crates/ruff_python_semantic/src/lib.rs | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/ruff_python_semantic/Cargo.toml b/crates/ruff_python_semantic/Cargo.toml index f3c1283996fca..f7bdbbe6349d1 100644 --- a/crates/ruff_python_semantic/Cargo.toml +++ b/crates/ruff_python_semantic/Cargo.toml @@ -14,7 +14,7 @@ license = { workspace = true } doctest = false [dependencies] -ruff_db = { workspace = true } +ruff_db = { workspace = true, optional = true } ruff_index = { workspace = true } ruff_python_ast = { workspace = true } ruff_python_stdlib = { workspace = true } @@ -23,8 +23,8 @@ ruff_text_size = { workspace = true } bitflags = { workspace = true } is-macro = { workspace = true } -salsa = { workspace = true } -tracing = { workspace = true } +salsa = { workspace = true, optional = true } +tracing = { workspace = true, optional = true } rustc-hash = { workspace = true } [dev-dependencies] @@ -32,3 +32,6 @@ ruff_python_parser = { workspace = true } [lints] workspace = true + +[features] +red_knot = ["dep:ruff_db", "dep:salsa", "dep:tracing"] diff --git a/crates/ruff_python_semantic/src/lib.rs b/crates/ruff_python_semantic/src/lib.rs index c0ca0c7a4a8bf..4a6be79c98447 100644 --- a/crates/ruff_python_semantic/src/lib.rs +++ b/crates/ruff_python_semantic/src/lib.rs @@ -2,6 +2,7 @@ pub mod analyze; mod binding; mod branches; mod context; +#[cfg(feature = "red_knot")] mod db; mod definition; mod globals; @@ -22,4 +23,5 @@ pub use reference::*; pub use scope::*; pub use star_import::*; +#[cfg(feature = "red_knot")] pub use db::{Db, Jar};