Improve Message sorting performance (#4624)

This commit is contained in:
Micha Reiser 2023-05-24 16:34:48 +02:00 committed by GitHub
parent 17d938f078
commit 85f094f592
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 10 deletions

View file

@ -6,6 +6,7 @@ use std::ops::Deref;
use ruff_text_size::{TextRange, TextSize};
use rustc_hash::FxHashMap;
use crate::jupyter::JupyterIndex;
pub use azure::AzureEmitter;
pub use github::GithubEmitter;
pub use gitlab::GitlabEmitter;
@ -17,9 +18,6 @@ use ruff_diagnostics::{Diagnostic, DiagnosticKind, Fix};
use ruff_python_ast::source_code::{SourceFile, SourceLocation};
pub use text::TextEmitter;
use crate::jupyter::JupyterIndex;
use crate::registry::AsRule;
mod azure;
mod diff;
mod github;
@ -77,11 +75,7 @@ impl Message {
impl Ord for Message {
fn cmp(&self, other: &Self) -> Ordering {
(self.filename(), self.start(), self.kind.rule()).cmp(&(
other.filename(),
other.start(),
other.kind.rule(),
))
(&self.file, self.start()).cmp(&(&other.file, other.start()))
}
}