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:
Dhruv Manilawala 2024-06-27 07:56:08 +05:30 committed by Micha Reiser
parent 73851e73ab
commit 72b6c26101
10 changed files with 96 additions and 99 deletions

View file

@ -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,