mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:41:23 +00:00
Remove separate push
method (#9258)
This commit is contained in:
parent
34d7584ca3
commit
09ac0f9e72
1 changed files with 2 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
||||||
use ruff_diagnostics::{Diagnostic, DiagnosticKind};
|
use ruff_diagnostics::Diagnostic;
|
||||||
use ruff_python_codegen::Stylist;
|
use ruff_python_codegen::Stylist;
|
||||||
use ruff_python_parser::lexer::LexResult;
|
use ruff_python_parser::lexer::LexResult;
|
||||||
use ruff_python_parser::TokenKind;
|
use ruff_python_parser::TokenKind;
|
||||||
|
@ -97,7 +97,7 @@ pub(crate) fn check_logical_lines(
|
||||||
indent_size,
|
indent_size,
|
||||||
) {
|
) {
|
||||||
if settings.rules.enabled(kind.rule()) {
|
if settings.rules.enabled(kind.rule()) {
|
||||||
context.push(kind, range);
|
context.push_diagnostic(Diagnostic::new(kind, range));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,18 +123,6 @@ impl<'a> LogicalLinesContext<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn push<K: Into<DiagnosticKind>>(&mut self, kind: K, range: TextRange) {
|
|
||||||
let kind = kind.into();
|
|
||||||
if self.settings.rules.enabled(kind.rule()) {
|
|
||||||
self.diagnostics.push(Diagnostic {
|
|
||||||
kind,
|
|
||||||
range,
|
|
||||||
fix: None,
|
|
||||||
parent: None,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn push_diagnostic(&mut self, diagnostic: Diagnostic) {
|
pub(crate) fn push_diagnostic(&mut self, diagnostic: Diagnostic) {
|
||||||
if self.settings.rules.enabled(diagnostic.kind.rule()) {
|
if self.settings.rules.enabled(diagnostic.kind.rule()) {
|
||||||
self.diagnostics.push(diagnostic);
|
self.diagnostics.push(diagnostic);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue