mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 14:52:01 +00:00
ruff_db: rename Diagnostic
to OldDiagnosticTrait
This trait should eventually go away, so we rename it (and supporting types) to make room for a new concrete `Diagnostic` type. This commit is just the rename. In the next commit, we'll move it to a different module.
This commit is contained in:
parent
81bcdcebd3
commit
021640a7a6
14 changed files with 91 additions and 83 deletions
|
@ -6,7 +6,7 @@ use crate::types::diagnostic::{
|
|||
};
|
||||
use crate::types::signatures::Parameter;
|
||||
use crate::types::{todo_type, CallableType, UnionType};
|
||||
use ruff_db::diagnostic::{SecondaryDiagnosticMessage, Span};
|
||||
use ruff_db::diagnostic::{OldSecondaryDiagnosticMessage, Span};
|
||||
use ruff_python_ast as ast;
|
||||
use ruff_text_size::Ranged;
|
||||
|
||||
|
@ -388,7 +388,7 @@ impl<'db> CallBindingError<'db> {
|
|||
if let Some(span) =
|
||||
Self::parameter_span_from_index(context.db(), callable_ty, parameter.index)
|
||||
{
|
||||
messages.push(SecondaryDiagnosticMessage::new(
|
||||
messages.push(OldSecondaryDiagnosticMessage::new(
|
||||
span,
|
||||
"parameter declared in function definition here",
|
||||
));
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::fmt;
|
|||
|
||||
use drop_bomb::DebugDropBomb;
|
||||
use ruff_db::{
|
||||
diagnostic::{DiagnosticId, SecondaryDiagnosticMessage, Severity},
|
||||
diagnostic::{DiagnosticId, OldSecondaryDiagnosticMessage, Severity},
|
||||
files::File,
|
||||
};
|
||||
use ruff_text_size::{Ranged, TextRange};
|
||||
|
@ -84,7 +84,7 @@ impl<'db> InferContext<'db> {
|
|||
lint: &'static LintMetadata,
|
||||
ranged: T,
|
||||
message: fmt::Arguments,
|
||||
secondary_messages: Vec<SecondaryDiagnosticMessage>,
|
||||
secondary_messages: Vec<OldSecondaryDiagnosticMessage>,
|
||||
) where
|
||||
T: Ranged,
|
||||
{
|
||||
|
@ -136,7 +136,7 @@ impl<'db> InferContext<'db> {
|
|||
id: DiagnosticId,
|
||||
severity: Severity,
|
||||
message: fmt::Arguments,
|
||||
secondary_messages: Vec<SecondaryDiagnosticMessage>,
|
||||
secondary_messages: Vec<OldSecondaryDiagnosticMessage>,
|
||||
) where
|
||||
T: Ranged,
|
||||
{
|
||||
|
|
|
@ -8,7 +8,9 @@ use crate::types::string_annotation::{
|
|||
};
|
||||
use crate::types::{ClassLiteralType, KnownInstanceType, Type};
|
||||
use crate::{declare_lint, Db};
|
||||
use ruff_db::diagnostic::{Diagnostic, DiagnosticId, SecondaryDiagnosticMessage, Severity, Span};
|
||||
use ruff_db::diagnostic::{
|
||||
DiagnosticId, OldDiagnosticTrait, OldSecondaryDiagnosticMessage, Severity, Span,
|
||||
};
|
||||
use ruff_db::files::File;
|
||||
use ruff_python_ast::{self as ast, AnyNodeRef};
|
||||
use ruff_text_size::TextRange;
|
||||
|
@ -828,7 +830,7 @@ pub struct TypeCheckDiagnostic {
|
|||
pub(crate) range: TextRange,
|
||||
pub(crate) severity: Severity,
|
||||
pub(crate) file: File,
|
||||
pub(crate) secondary_messages: Vec<SecondaryDiagnosticMessage>,
|
||||
pub(crate) secondary_messages: Vec<OldSecondaryDiagnosticMessage>,
|
||||
}
|
||||
|
||||
impl TypeCheckDiagnostic {
|
||||
|
@ -845,7 +847,7 @@ impl TypeCheckDiagnostic {
|
|||
}
|
||||
}
|
||||
|
||||
impl Diagnostic for TypeCheckDiagnostic {
|
||||
impl OldDiagnosticTrait for TypeCheckDiagnostic {
|
||||
fn id(&self) -> DiagnosticId {
|
||||
self.id
|
||||
}
|
||||
|
@ -858,7 +860,7 @@ impl Diagnostic for TypeCheckDiagnostic {
|
|||
Some(Span::from(self.file).with_range(self.range))
|
||||
}
|
||||
|
||||
fn secondary_messages(&self) -> &[SecondaryDiagnosticMessage] {
|
||||
fn secondary_messages(&self) -> &[OldSecondaryDiagnosticMessage] {
|
||||
&self.secondary_messages
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue