ruff/crates
Alex Waygood ce8b744f17
Some checks are pending
CI / cargo clippy (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / mkdocs (push) Waiting to run
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
[ty] Only calculate information for unresolved-reference subdiagnostic if we know we'll emit the diagnostic (#18465)
## Summary

This optimizes some of the logic added in
https://github.com/astral-sh/ruff/pull/18444. In general, we only
calculate information for subdiagnostics if we know we'll actually emit
the diagnostic. The check to see whether we'll emit the diagnostic is
work we'll definitely have to do whereas the the work to gather
information for a subdiagnostic isn't work we necessarily have to do if
the diagnostic isn't going to be emitted at all.

This PR makes us lazier about gathering the information we need for the
subdiagnostic, and moves all the subdiagnostic logic into one function
rather than having some `unresolved-reference` subdiagnostic logic in
`infer.rs` and some in `diagnostic.rs`.

## Test Plan

`cargo test -p ty_python_semantic`
2025-06-04 20:41:00 +01:00
..
ruff Add a SourceFile to OldDiagnostic (#18356) 2025-05-30 13:34:38 +00:00
ruff_annotate_snippets Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_benchmark [ty] Add --config-file CLI arg (#18083) 2025-05-27 08:00:38 +02:00
ruff_cache Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_db Update salsa past generational id change (#18362) 2025-05-30 15:31:33 +02:00
ruff_dev Add a ViolationMetadata::rule method (#18234) 2025-05-28 09:27:09 -04:00
ruff_diagnostics Add a ViolationMetadata::rule method (#18234) 2025-05-28 09:27:09 -04:00
ruff_formatter Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_graph [ty] Infer the Python version from the environment if feasible (#18057) 2025-05-30 21:22:51 +00:00
ruff_index Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_linter [pyupgrade] Make fix unsafe if it deletes comments (UP050) (#18390) 2025-06-03 09:10:15 -04:00
ruff_macros Add a ViolationMetadata::rule method (#18234) 2025-05-28 09:27:09 -04:00
ruff_notebook Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_options_metadata [ty] Document configuration schema (#17950) 2025-05-09 10:47:45 +02:00
ruff_python_ast Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
ruff_python_ast_integration_tests Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
ruff_python_codegen Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
ruff_python_formatter Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
ruff_python_index Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_literal Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_parser Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
ruff_python_resolver Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_semantic Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
ruff_python_stdlib Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_trivia Add offset method to ruff_python_trivia::Cursor (#18371) 2025-05-29 16:08:15 +01:00
ruff_python_trivia_integration_tests Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_server Add a ViolationMetadata::rule method (#18234) 2025-05-28 09:27:09 -04:00
ruff_source_file Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_text_size Add rustfmt.toml file (#18197) 2025-05-19 11:40:58 -04:00
ruff_wasm Bump 0.11.12 (#18369) 2025-05-29 09:17:12 -04:00
ruff_workspace Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ty [ty] Only calculate information for unresolved-reference subdiagnostic if we know we'll emit the diagnostic (#18465) 2025-06-04 20:41:00 +01:00
ty_ide [ty] IDE: only provide declarations and bindings as completions (#18456) 2025-06-04 16:11:05 +02:00
ty_project [ty] Infer the Python version from the environment if feasible (#18057) 2025-05-30 21:22:51 +00:00
ty_python_semantic [ty] Only calculate information for unresolved-reference subdiagnostic if we know we'll emit the diagnostic (#18465) 2025-06-04 20:41:00 +01:00
ty_server [ty] Fix server hang after shutdown request (#18414) 2025-06-02 06:57:51 +00:00
ty_test [ty] Infer the Python version from the environment if feasible (#18057) 2025-05-30 21:22:51 +00:00
ty_vendored Sync vendored typeshed stubs (#18407) 2025-06-01 15:21:18 +01:00
ty_wasm Use ty's completions in playground (#18425) 2025-06-03 10:11:39 +02:00