From b535a785f808f8207ef2f89e2d94b8e34bfe692f Mon Sep 17 00:00:00 2001 From: bluthej Date: Sun, 8 Oct 2023 23:09:20 +0200 Subject: [PATCH] Fix diff (old and new were reversed) --- crates/ruff_cli/tests/integration_test.rs | 12 ++++++------ crates/ruff_linter/src/source_kind.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/ruff_cli/tests/integration_test.rs b/crates/ruff_cli/tests/integration_test.rs index 07275021c8f22..7937af211cab3 100644 --- a/crates/ruff_cli/tests/integration_test.rs +++ b/crates/ruff_cli/tests/integration_test.rs @@ -1111,8 +1111,8 @@ fn diff_shows_safe_fixes_by_default() { ----- stdout ----- @@ -1,2 +1,2 @@ x = {'a': 1, 'a': 1} - -print('foo') - +print(('foo')) + -print(('foo')) + +print('foo') ----- stderr ----- @@ -1142,10 +1142,10 @@ fn diff_shows_unsafe_fixes_with_opt_in() { exit_code: 1 ----- stdout ----- @@ -1,2 +1,2 @@ - -x = {'a': 1} - -print('foo') - +x = {'a': 1, 'a': 1} - +print(('foo')) + -x = {'a': 1, 'a': 1} + -print(('foo')) + +x = {'a': 1} + +print('foo') ----- stderr ----- diff --git a/crates/ruff_linter/src/source_kind.rs b/crates/ruff_linter/src/source_kind.rs index c98b5fc50ae33..1cca0017bbdaf 100644 --- a/crates/ruff_linter/src/source_kind.rs +++ b/crates/ruff_linter/src/source_kind.rs @@ -91,7 +91,7 @@ impl SourceKind { pub fn diff(&self, other: &Self, path: Option<&Path>, writer: &mut dyn Write) -> Result<()> { match (self, other) { (SourceKind::Python(src), SourceKind::Python(dst)) => { - let text_diff = TextDiff::from_lines(dst, src); + let text_diff = TextDiff::from_lines(src, dst); let mut unified_diff = text_diff.unified_diff(); if let Some(path) = path {