Add support for Rust 1.43 (#13)

This commit is contained in:
Armin Ronacher 2021-02-15 20:54:41 +01:00 committed by GitHub
parent d95660a260
commit b1a0b0f8a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 20 deletions

View file

@ -4,10 +4,15 @@ on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- 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

View file

@ -4,10 +4,15 @@ on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- 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

View file

@ -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
- 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

View file

@ -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.

1
clippy.toml Normal file
View file

@ -0,0 +1 @@
msrv = "1.42.0"

View file

@ -22,10 +22,10 @@ where
D: DiffHook,
New::Output: PartialEq<Old::Output>,
{
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(());
}

View file

@ -118,7 +118,7 @@ where
New: Index<usize> + ?Sized,
New::Output: PartialEq<Old::Output>,
{
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<usize> + ?Sized,
New::Output: PartialEq<Old::Output>,
{
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,