mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 23:25:14 +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
|
@ -1,17 +1,17 @@
|
|||
use crate::{
|
||||
lint::Diagnostics,
|
||||
lint::DiagnosticsMap,
|
||||
server::client::Notifier,
|
||||
session::{DocumentQuery, DocumentSnapshot},
|
||||
};
|
||||
|
||||
use super::LSPResult;
|
||||
|
||||
pub(super) fn generate_diagnostics(snapshot: &DocumentSnapshot) -> Diagnostics {
|
||||
pub(super) fn generate_diagnostics(snapshot: &DocumentSnapshot) -> DiagnosticsMap {
|
||||
if snapshot.client_settings().lint() {
|
||||
let document = snapshot.query();
|
||||
crate::lint::check(document, snapshot.encoding())
|
||||
} else {
|
||||
Diagnostics::default()
|
||||
DiagnosticsMap::default()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue