mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 12:29:28 +00:00
Simplify LinterResult
, avoid cloning ParseError
(#11903)
## Summary Follow-up to #11902 This PR simplifies the `LinterResult` struct by avoiding the generic and not store the `ParseError`. This is possible because the callers already have access to the `ParseError` via the `Parsed` output. This also means that we can simplify the return type of `check_path` and avoid the generic `T` on `LinterResult`. ## Test Plan `cargo insta test`
This commit is contained in:
parent
73851e73ab
commit
72b6c26101
10 changed files with 96 additions and 99 deletions
|
@ -9,7 +9,7 @@ use ruff_formatter::printer::SourceMapGeneration;
|
|||
use ruff_formatter::{FormatResult, Formatted, IndentStyle};
|
||||
use ruff_linter::directives;
|
||||
use ruff_linter::line_width::{IndentWidth, LineLength};
|
||||
use ruff_linter::linter::{check_path, LinterResult};
|
||||
use ruff_linter::linter::check_path;
|
||||
use ruff_linter::registry::AsRule;
|
||||
use ruff_linter::settings::types::PythonVersion;
|
||||
use ruff_linter::settings::{flags, DEFAULT_SELECTORS, DUMMY_VARIABLE_RGX};
|
||||
|
@ -181,9 +181,7 @@ impl Workspace {
|
|||
);
|
||||
|
||||
// Generate checks.
|
||||
let LinterResult {
|
||||
data: diagnostics, ..
|
||||
} = check_path(
|
||||
let diagnostics = check_path(
|
||||
Path::new("<filename>"),
|
||||
None,
|
||||
&locator,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue