[workspace] members = ["crates/*"] resolver = "2" [workspace.package] # Please update rustfmt.toml when bumping the Rust edition edition = "2024" rust-version = "1.97" homepage = "https://docs.astral.sh/ruff" documentation = "https://docs.astral.sh/ruff" repository = "https://github.com/astral-sh/ruff" authors = ["Charlie Marsh "] license = "MIT" [workspace.dependencies] char_str = { version = "0.0.4", default-features = false, features = ["std"] } ruff = { version = "0.17.3", path = "crates/ruff" } ruff_annotate_snippets = { version = "0.0.20", path = "crates/ruff_annotate_snippets" } ruff_cache = { version = "0.0.20", path = "crates/ruff_cache" } ruff_command_line = { version = "0.0.20", path = "crates/ruff_command_line" } ruff_db = { version = "0.0.20", path = "crates/ruff_db", default-features = false } ruff_diagnostics = { version = "0.0.20", path = "crates/ruff_diagnostics" } ruff_formatter = { version = "0.0.20", path = "crates/ruff_formatter" } ruff_graph = { version = "0.0.20", path = "crates/ruff_graph" } ruff_index = { version = "0.0.20", path = "crates/ruff_index" } ruff_linter = { version = "0.17.3", path = "crates/ruff_linter" } ruff_macros = { version = "0.0.20", path = "crates/ruff_macros" } ruff_markdown = { version = "0.0.20", path = "crates/ruff_markdown" } ruff_memory_usage = { version = "0.0.20", path = "crates/ruff_memory_usage" } ruff_notebook = { version = "0.0.20", path = "crates/ruff_notebook" } ruff_options_metadata = { version = "0.0.20", path = "crates/ruff_options_metadata" } ruff_python_ast = { version = "0.0.20", path = "crates/ruff_python_ast" } ruff_python_codegen = { version = "0.0.20", path = "crates/ruff_python_codegen" } ruff_python_edits = { version = "0.0.20", path = "crates/ruff_python_edits" } ruff_python_formatter = { version = "0.0.20", path = "crates/ruff_python_formatter" } ruff_python_importer = { version = "0.0.20", path = "crates/ruff_python_importer" } ruff_python_index = { version = "0.0.20", path = "crates/ruff_python_index" } ruff_python_literal = { version = "0.0.20", path = "crates/ruff_python_literal" } ruff_python_parser = { version = "0.0.20", path = "crates/ruff_python_parser" } ruff_python_semantic = { version = "0.0.20", path = "crates/ruff_python_semantic" } ruff_python_stdlib = { version = "0.0.20", path = "crates/ruff_python_stdlib" } ruff_python_trivia = { version = "0.0.20", path = "crates/ruff_python_trivia" } ruff_server = { version = "0.0.20", path = "crates/ruff_server" } ruff_source_file = { version = "0.0.20", path = "crates/ruff_source_file" } ruff_mdtest = { path = "crates/ruff_mdtest" } ruff_ranged_value = { version = "0.0.20", path = "crates/ruff_ranged_value" } ruff_text_size = { version = "0.0.20", path = "crates/ruff_text_size" } ruff_unicode_names2 = { version = "0.0.20", path = "crates/ruff_unicode_names2" } ruff_unicode_names2_generator = { version = "0.0.20", path = "crates/ruff_unicode_names2_generator" } ruff_workspace = { version = "0.0.20", path = "crates/ruff_workspace" } ty = { path = "crates/ty" } ty_combine = { version = "0.0.20", path = "crates/ty_combine" } ty_completion_bench = { path = "crates/ty_completion_bench" } ty_completion_eval = { path = "crates/ty_completion_eval" } ty_ide = { path = "crates/ty_ide" } ty_module_resolver = { version = "0.0.20", path = "crates/ty_module_resolver" } ty_project = { path = "crates/ty_project", default-features = false } ty_python_semantic = { version = "0.0.20", path = "crates/ty_python_semantic" } ty_python_core = { version = "0.0.20", path = "crates/ty_python_core" } ty_server = { path = "crates/ty_server" } ty_site_packages = { version = "0.0.20", path = "crates/ty_site_packages" } ty_static = { version = "0.0.20", path = "crates/ty_static" } ty_test = { path = "crates/ty_test" } ty_vendored = { version = "0.0.20", path = "crates/ty_vendored" } mdtest = { path = "crates/mdtest" } aho-corasick = { version = "1.1.3", default-features = false, features = ["perf-literal", "std"] } arrayvec = { version = "0.7.6", default-features = false } anstream = { version = "1.0.0", default-features = false, features = ["auto", "wincon"] } anstyle = { version = "1.0.10", default-features = false, features = ["std"] } anyhow = { version = "1.0.80", default-features = false, features = ["std"] } arc-swap = { version = "1.7.1", default-features = false } argfile = { version = "1.0.0", default-features = false } assert_fs = { version = "1.1.0", default-features = false } rkyv = { version = "0.8.16", default-features = false, features = ["bytecheck", "std"] } bitflags = { version = "2.5.0", default-features = false } bitvec = { version = "1.0.1", default-features = false, features = [ "alloc", ] } bstr = { version = "1.9.1", default-features = false, features = ["std"] } cachedir = { version = "0.3.1", default-features = false } camino = { version = "1.1.7", default-features = false } clap = { version = "4.5.3", default-features = false, features = [ "color", "derive", "error-context", "help", "std", "suggestions", "usage", ] } clap_complete_command = { version = "0.6.0", default-features = false, features = ["nushell"] } clearscreen = { version = "4.0.0", default-features = false } codspeed-criterion-compat = { version = "5.0.0", default-features = false } colored = { version = "3.0.0", default-features = false } compact_str = { version = "0.10.0", default-features = false, features = ["std"] } console_error_panic_hook = { version = "0.1.7", default-features = false } console_log = { version = "1.0.0", default-features = false } countme = { version = "3.0.1", default-features = false } criterion = { version = "0.8.0", default-features = false } crossbeam = { version = "0.8.4", default-features = false, features = ["std"] } csv = { version = "1.3.1", default-features = false } ctrlc = { version = "3.4.4", default-features = false } dashmap = { version = "6.0.1", default-features = false } datatest-stable = { version = "0.3.3", default-features = false } divan = { package = "codspeed-divan-compat", version = "5.0.0", default-features = false } drop_bomb = { version = "0.1.5", default-features = false } dunce = { version = "1.0.5", default-features = false } etcetera = { version = "0.11.0", default-features = false } fern = { version = "0.7.0", default-features = false } filetime = { version = "0.2.23", default-features = false } get-size2 = { version = "0.11.0", default-features = false, features = [ "compact-str", "derive", "hashbrown", "ordermap", "smallvec", "std", "thin-vec", ] } glob = { version = "0.3.1", default-features = false } globset = { version = "0.4.14", default-features = false, features = ["log"] } globwalk = { version = "0.9.1", default-features = false } hashbrown = { version = "0.17.0", default-features = false, features = [ "inline-more", ] } heck = { version = "0.5.0", default-features = false } icu_normalizer = { version = "2.1.2", default-features = false, features = ["compiled_data"] } icu_properties = { version = "2.1.2", default-features = false, features = ["compiled_data"] } ignore = { version = "0.4.30", default-features = false } imara-diff = { version = "0.2.0", default-features = false } imperative = { version = "1.0.4", default-features = false } indexmap = { version = "2.6.0", default-features = false, features = ["std"] } indicatif = { version = "0.18.0", default-features = false, features = ["unicode-width"] } indoc = { version = "2.0.4", default-features = false } insta = { version = "1.35.1", default-features = false, features = ["colors"] } insta-cmd = { version = "0.7.0", default-features = false } is-macro = { version = "0.3.5", default-features = false } itertools = { version = "0.15.0", default-features = false, features = ["use_std"] } jiff = { version = "0.2.0", default-features = false, features = [ "perf-inline", "std", "tz-fat", "tz-system", "tzdb-bundle-platform", "tzdb-concatenated", "tzdb-zoneinfo", ] } jod-thread = { version = "1.0.0", default-features = false } js-sys = { version = "0.3.69", default-features = false, features = ["std"] } libc = { version = "0.2.153", default-features = false, features = ["std"] } libcst = { version = "1.9.0", default-features = false } log = { version = "0.4.17", default-features = false } lsp-server = { version = "0.10.0", default-features = false } lsp-types = { package = "gen-lsp-types", version = "0.11.0", default-features = false, features = ["url"] } markdown = { version = "1.0.0", default-features = false } matchit = { version = "0.9.0", default-features = false } memchr = { version = "2.7.1", default-features = false, features = ["std"] } # mimalloc v3.3.2 crashes on Windows CPUs that do not support POPCNT. # Fixed in mimalloc v3.4.0: https://github.com/microsoft/mimalloc/issues/1291 # Keep v2 until an updated Rust crate includes the fix. mimalloc = { version = "0.1.52", default-features = false, features = ["v2"] } natord = { version = "1.0.9", default-features = false } notify = { version = "8.0.0", default-features = false, features = ["macos_fsevent"] } ordermap = { version = "1.0.0", default-features = false, features = ["std"] } parking_lot = { version = "0.12.4", default-features = false } path-absolutize = { version = "4.0.0", default-features = false } path-slash = { version = "0.2.1", default-features = false } pathdiff = { version = "0.2.1", default-features = false } phf = { version = "0.14.0", default-features = false } phf_codegen = { version = "0.14.0", default-features = false } pep440_rs = { version = "0.7.1", default-features = false } pretty_assertions = { version = "1.3.0", default-features = false, features = ["std"] } proc-macro2 = { version = "1.0.79", default-features = false, features = ["proc-macro"] } pyproject-toml = { version = "0.13.4", default-features = false } quick-junit = { version = "0.8.0", default-features = false } quickcheck = { version = "1.0.3", default-features = false } quickcheck_macros = { version = "1.0.0", default-features = false } quote = { version = "1.0.23", default-features = false, features = ["proc-macro"] } rand = { version = "0.10.0", default-features = false, features = ["std_rng"] } rayon = { version = "1.10.0", default-features = false } regex = { version = "1.10.2", default-features = false, features = ["perf", "std", "unicode"] } regex-automata = { version = "0.4.9", default-features = false, features = [ "dfa-build", "dfa-search", "perf", "std", "syntax", ] } regex-syntax = { version = "0.8.8", default-features = false } rustc-hash = { version = "2.0.0", default-features = false, features = ["std"] } rustc-stable-hash = { version = "0.1.2", default-features = false } # When updating salsa, make sure to also update the version in `fuzz/Cargo.toml` salsa = { version = "0.28.5", default-features = false, features = [ "compact_str", "macros", "salsa_unstable", "inventory", ] } same-file = { version = "1.0.6", default-features = false } schemars = { version = "1.0.4", default-features = false, features = ["derive", "std"] } seahash = { version = "4.1.0", default-features = false } serde = { version = "1.0.197", default-features = false, features = ["derive", "std"] } serde-wasm-bindgen = { version = "0.6.4", default-features = false } serde_json = { version = "1.0.113", default-features = false, features = ["std"] } serde_test = { version = "1.0.152", default-features = false } shellexpand = { version = "3.0.0", default-features = false, features = ["base-0", "tilde"] } similar = { version = "3.0.0", default-features = false, features = ["inline", "std", "text"] } smallvec = { version = "1.13.2", default-features = false, features = ["union", "const_generics", "const_new"] } snapbox = { version = "1.0.0", default-features = false, features = [ "color-auto", "diff", "term-svg", "cmd", "examples", ] } static_assertions = { version = "1.1.0", default-features = false } stacker = { version = "0.1.24", default-features = false } strum = { version = "0.28.0", default-features = false, features = ["std", "strum_macros"] } strum_macros = { version = "0.28.0", default-features = false } supports-hyperlinks = { version = "3.1.0", default-features = false } syn = { version = "3.0.0", default-features = false, features = [ "clone-impls", "derive", "parsing", "printing", "proc-macro", ] } tempfile = { version = "3.9.0", default-features = false, features = ["getrandom"] } test-case = { version = "3.3.1", default-features = false } thiserror = { version = "2.0.0", default-features = false, features = ["std"] } thin-vec = { version = "0.2.14", default-features = false, features = ["std"] } tikv-jemallocator = { version = "0.6.0", default-features = false, features = ["background_threads_runtime_support"] } toml = { version = "1.0.0", default-features = false, features = ["display", "parse", "serde", "std"] } toml_parser = { version = "1.0.0", default-features = false, features = ["std"] } tracing = { version = "0.1.40", default-features = false, features = ["attributes", "std"] } tracing-flame = { version = "0.2.0", default-features = false, features = ["smallvec"] } tracing-indicatif = { version = "0.3.11", default-features = false } tracing-log = { version = "0.2.0", default-features = false, features = ["log-tracer", "std"] } tracing-subscriber = { version = "0.3.18", default-features = false, features = [ "env-filter", "fmt", "ansi", "smallvec", ] } typed-arena = { version = "2.0.2", default-features = false, features = ["std"] } unicode-ident = { version = "1.0.12", default-features = false } unicode-normalization = { version = "0.1.23", default-features = false, features = ["std"] } unicode-width = { version = "0.2.0", default-features = false } url = { version = "2.5.0", default-features = false, features = ["std"] } uuid = { version = "1.6.1", default-features = false, features = ["std"] } walkdir = { version = "2.3.2", default-features = false } wasm-bindgen = { version = "0.2.92", default-features = false, features = ["std"] } wasm-bindgen-test = { version = "0.3.42", default-features = false, features = ["std"] } web-time = { version = "1.1.0", default-features = false } which = { version = "8.0.0", default-features = false, features = ["real-sys"] } wild = { version = "2", default-features = false } zip = { version = "8.0", default-features = false } [workspace.metadata.cargo-shear] ignored = [ "ruff_mdtest", "ty_completion_bench", "ty_completion_eval", ] [workspace.lints.rust] unsafe_code = "warn" unreachable_pub = "warn" unexpected_cfgs = { level = "warn", check-cfg = [ "cfg(fuzzing)", "cfg(codspeed)", ] } [workspace.lints.clippy] pedantic = { level = "warn", priority = -2 } # Enabled at the crate level disallowed_methods = "allow" # Allowed pedantic lints assert_is_empty = "allow" char_lit_as_u8 = "allow" collapsible_else_if = "allow" collapsible_if = "allow" implicit_hasher = "allow" map_unwrap_or = "allow" match_same_arms = "allow" missing_errors_doc = "allow" missing_panics_doc = "allow" module_name_repetitions = "allow" must_use_candidate = "allow" # Our formatting macros share names with std macros but use square brackets. nonstandard_macro_braces = "allow" similar_names = "allow" single_match_else = "allow" too_many_lines = "allow" collapsible_match = "allow" # Not always an improvement in readability, quite opinionated needless_continue = "allow" # An explicit continue can be more readable, especially if the alternative is an empty block. unnecessary_debug_formatting = "allow" # too many instances, the display also doesn't quote the path which is often desired in logs where we use them the most often. # Without the hashes we run into a `rustfmt` bug in some snapshot tests, see #13250 needless_raw_string_hashes = "allow" # Disallowed restriction lints ignore_without_reason = "allow" # Too many existing instances, and there's no auto fix. iter_over_hash_type = "warn" print_stdout = "warn" print_stderr = "warn" dbg_macro = "warn" empty_drop = "warn" empty_structs_with_brackets = "warn" exit = "warn" get_unwrap = "warn" rc_buffer = "warn" rc_mutex = "warn" rest_pat_in_fully_bound_structs = "warn" # nursery rules redundant_clone = "warn" debug_assert_with_mut_call = "warn" unused_peekable = "warn" # This lint sometimes flags code whose `if` and `else` # bodies could be flipped when a `!` operator is removed. # While perhaps sometimes a good idea, it is also often # not a good idea due to other factors impacting # readability. For example, if flipping the bodies results # in the `if` being an order of magnitude bigger than the # `else`, then some might consider that harder to read. if_not_else = "allow" [profile.release] lto = "fat" codegen-units = 16 # Some crates don't change as much but benefit more from # more expensive optimization passes, so we selectively # decrease codegen-units in some cases. [profile.release.package.ruff_python_parser] codegen-units = 1 [profile.release.package.ruff_python_ast] codegen-units = 1 [profile.release.package.salsa] codegen-units = 1 # Profile to build a minimally sized binary for ruff/ty [profile.minimal-size] inherits = "release" opt-level = "z" codegen-units = 1 [profile.dev] opt-level = 1 debug = "line-tables-only" # Avoid the local ThinLTO that Cargo enables at nonzero optimization levels. lto = "off" [profile.dev.package.insta] opt-level = 3 [profile.dev.package.similar] opt-level = 3 [profile.dev.package.salsa] opt-level = 3 # Reduce complexity of a parser function that would trigger a locals limit in a wasm tool. # https://github.com/bytecodealliance/wasm-tools/blob/b5c3d98e40590512a3b12470ef358d5c7b983b15/crates/wasmparser/src/limits.rs#L29 [profile.dev.package.ruff_python_parser] opt-level = 1 # This profile is meant to mimic the `release` profile as closely as # possible, but using settings that are more beneficial for iterative # development. That is, the `release` profile is intended for actually # building the release, where as `profiling` is meant for building ty/ruff # for running benchmarks. # # The main differences here are to avoid stripping debug information # and disabling fat lto. This does result in a mismatch between our release # configuration and our benchmarking configuration, which is unfortunate. # But compile times with `lto = fat` are completely untenable. # # This setup does risk that we are measuring something in benchmarks # that we aren't shipping, but in order to make those two the same, we'd # either need to make compile times way worse for development, or take # a hit to binary size and a slight hit to runtime performance in our # release builds. # # Use the `--profile profiling` flag to show symbols in release mode. # e.g. `cargo build --profile profiling` [profile.profiling] inherits = "release" strip = false debug = "full" lto = false # Profile for faster iteration: applies minimal optimizations for faster tests. [profile.fast-test] inherits = "dev" opt-level = 1 debug = "line-tables-only" # Avoid the local ThinLTO that Cargo enables at nonzero optimization levels. lto = "off" # The profile that 'cargo dist' will build with. [profile.dist] inherits = "release"