Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions crates/oxc_linter/src/fixer/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ impl<'a> Deref for RuleFix<'a> {
/// A completed, normalized fix ready to be applied to the source code.
///
/// Used internally by this module. Lint rules should use [`RuleFix`].
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub struct Fix<'a> {
pub content: Cow<'a, str>,
Expand Down Expand Up @@ -334,7 +334,7 @@ impl<'a> Fix<'a> {
}
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum PossibleFixes<'a> {
None,
Single(Fix<'a>),
Expand Down Expand Up @@ -601,12 +601,6 @@ impl<'a> CompositeFix<'a> {
mod test {
use super::*;

impl PartialEq for Fix<'_> {
fn eq(&self, other: &Self) -> bool {
self.span == other.span && self.content == other.content
}
}

impl Clone for CompositeFix<'_> {
fn clone(&self) -> Self {
match self {
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/fixer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ pub struct FixResult<'a> {
pub messages: Vec<Message<'a>>,
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Message<'a> {
pub error: OxcDiagnostic,
pub fixes: PossibleFixes<'a>,
Expand Down
15 changes: 0 additions & 15 deletions crates/oxc_linter/src/tsgolint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,21 +793,6 @@ mod test {
tsgolint::{Fix, Range, RuleMessage, Suggestion, TsGoLintDiagnostic},
};

/// Implements `PartialEq` for `PossibleFixes` to enable equality assertions in tests.
/// In production a `PossibleFix` can not be equal.
impl PartialEq for PossibleFixes<'_> {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::None, Self::None) => true,
(Self::Single(fix1), Self::Single(fix2)) => fix1 == fix2,
(Self::Multiple(fixes1), Self::Multiple(fixes2)) => {
fixes1.iter().zip(fixes2.iter()).all(|(f1, f2)| f1 == f2)
}
_ => false,
}
}
}

#[test]
fn test_message_from_tsgo_lint_diagnostic_basic() {
let diagnostic = TsGoLintDiagnostic {
Expand Down
Loading