Skip to content

Commit 5c33fc7

Browse files
committed
refactor(diagnostics): implement Eq and Ord for InfoPosition (#12505)
Implement these traits to shorten code elsewhere.
1 parent d31adcf commit 5c33fc7

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

apps/oxlint/src/output_formatter/default.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,7 @@ mod test_implementation {
134134

135135
self.diagnostics.sort_by_cached_key(|diagnostic| {
136136
let info = Info::new(diagnostic);
137-
(
138-
info.filename,
139-
info.start.line,
140-
info.start.column,
141-
info.end.line,
142-
info.end.column,
143-
info.rule_id,
144-
info.message,
145-
)
137+
(info.filename, info.start, info.end, info.rule_id, info.message)
146138
});
147139

148140
for diagnostic in &self.diagnostics {

crates/oxc_diagnostics/src/reporter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub struct Info {
101101
pub rule_id: Option<String>,
102102
}
103103

104-
#[derive(Debug)]
104+
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
105105
pub struct InfoPosition {
106106
pub line: usize,
107107
pub column: usize,

0 commit comments

Comments
 (0)