diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 547ca71..e812a0e 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -4,10 +4,15 @@ on: [push] jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Run clippy - run: make lint + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + components: clippy, rustfmt + override: true + - name: Run clippy + run: make lint diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml index f075cf1..9002962 100644 --- a/.github/workflows/rustfmt.yml +++ b/.github/workflows/rustfmt.yml @@ -4,10 +4,15 @@ on: [push] jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Run rustfmt - run: make format-check + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + components: clippy, rustfmt + override: true + - name: Run rustfmt + run: make format-check diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 38bf178..8f9c5cd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,11 +3,30 @@ name: Tests on: [push] jobs: - build: - + build-latest: + name: Test on Latest runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Test - run: make test + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + - name: Test + run: make test + + build-stable: + name: Test on 1.43.0 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: 1.43.0 + profile: minimal + override: true + - name: Test + run: make test diff --git a/CHANGELOG.md b/CHANGELOG.md index 86324c4..69de1af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to similar are documented here. +## 1.3.0 + +* Added support for Rust 1.43.0 for better compatibility. + ## 1.2.0 * Make the unicode feature optional for inline diffing. diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 0000000..f97e544 --- /dev/null +++ b/clippy.toml @@ -0,0 +1 @@ +msrv = "1.42.0" diff --git a/src/algorithms/lcs.rs b/src/algorithms/lcs.rs index cfab0d0..b6f5d60 100644 --- a/src/algorithms/lcs.rs +++ b/src/algorithms/lcs.rs @@ -22,10 +22,10 @@ where D: DiffHook, New::Output: PartialEq, { - if new_range.is_empty() { + if new_range.start >= new_range.end { d.delete(old_range.start, old_range.len(), new_range.start)?; return Ok(()); - } else if old_range.is_empty() { + } else if old_range.start >= old_range.end { d.insert(old_range.start, new_range.start, new_range.len())?; return Ok(()); } diff --git a/src/algorithms/myers.rs b/src/algorithms/myers.rs index e4e98ad..ef38520 100644 --- a/src/algorithms/myers.rs +++ b/src/algorithms/myers.rs @@ -118,7 +118,7 @@ where New: Index + ?Sized, New::Output: PartialEq, { - if old_range.is_empty() || new_range.is_empty() { + if old_range.start >= old_range.end || new_range.start >= new_range.end { return 0; } new_range @@ -141,7 +141,7 @@ where New: Index + ?Sized, New::Output: PartialEq, { - if old_range.is_empty() || new_range.is_empty() { + if old_range.start >= old_range.end || new_range.start >= new_range.end { return 0; } new_range @@ -312,15 +312,15 @@ where old_range.end -= common_suffix_len; new_range.end -= common_suffix_len; - if old_range.is_empty() && new_range.is_empty() { + if old_range.start >= old_range.end && new_range.start >= new_range.end { // Do nothing - } else if new_range.is_empty() { + } else if new_range.start >= new_range.end { d.delete( old_range.start, old_range.end - old_range.start, new_range.start, )?; - } else if old_range.is_empty() { + } else if old_range.start >= old_range.end { d.insert( old_range.start, new_range.start,