Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.80.0
toolchain: 1.89.0
override: true
- run: cargo check
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ repository = "https://github.com/bmwill/diffy"
readme = "README.md"
keywords = ["diff", "patch", "merge"]
categories = ["text-processing"]
rust-version = "1.80.0"
edition = "2021"
rust-version = "1.89.0"
edition = "2024"

[dependencies]
nu-ansi-term = "0.50"
Expand All @@ -19,4 +19,4 @@ thiserror = "2.0.12"

[dev-dependencies]
insta = { version = "1.43.1", features = ["glob"] }
rstest = "0.25.0"
rstest = "0.26.1"
8 changes: 2 additions & 6 deletions src/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,7 @@ impl FuzzyComparable for [u8] {
s1.similarity(s2, config)
} else {
// Fall back to exact byte comparison
if self == other {
1.0
} else {
0.0
}
if self == other { 1.0 } else { 0.0 }
}
}
}
Expand Down Expand Up @@ -712,7 +708,7 @@ where
mod test {
use std::path::PathBuf;

use crate::{apply, Diff};
use crate::{Diff, apply};

fn load_files(name: &str) -> (String, String) {
let base_folder = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
Expand Down
2 changes: 1 addition & 1 deletion src/diff/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::{
LineEnd,
patch::{Diff, Hunk, HunkRange, Line},
range::{DiffRange, SliceLike},
utils::{Classifier, Text},
LineEnd,
};
use std::{borrow::Cow, cmp, ops};

Expand Down
4 changes: 2 additions & 2 deletions src/diff/tests.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use super::*;
use crate::{
PatchFormatter,
apply::apply,
diff::{DiffLine, DiffRange},
patch::Diff,
range::Range,
PatchFormatter,
};

// Helper macros are based off of the ones used in [dissimilar](https://docs.rs/dissimilar)
Expand Down Expand Up @@ -769,7 +769,7 @@ Second:
let elapsed = now.elapsed();

println!("{:?}", elapsed);
assert!(elapsed < std::time::Duration::from_micros(400));
assert!(elapsed < std::time::Duration::from_micros(600));

assert_eq!(result, expected);
}
Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ mod range;
mod utils;

pub use apply::{
apply, apply_bytes, apply_bytes_with_config, apply_with_config, ApplyConfig, ApplyError,
FuzzyConfig, LineEndHandling,
ApplyConfig, ApplyError, FuzzyConfig, LineEndHandling, apply, apply_bytes,
apply_bytes_with_config, apply_with_config,
};
pub use diff::{create_patch, create_patch_bytes, DiffOptions};
pub use diff::{DiffOptions, create_patch, create_patch_bytes};
pub use line_end::*;
pub use merge::{merge, merge_bytes, ConflictStyle, MergeOptions};
pub use merge::{ConflictStyle, MergeOptions, merge, merge_bytes};
pub use patch::{
patch_from_bytes, patch_from_bytes_with_config, patch_from_str, patch_from_str_with_config,
Diff, Hunk, HunkRange, HunkRangeStrategy, Line, ParsePatchError, ParserConfig, Patch,
PatchFormatter,
PatchFormatter, patch_from_bytes, patch_from_bytes_with_config, patch_from_str,
patch_from_str_with_config,
};
6 changes: 3 additions & 3 deletions src/merge/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::{
LineEnd,
diff::DiffOptions,
range::{DiffRange, Range, SliceLike},
utils::Classifier,
LineEnd,
};
use std::{cmp, fmt};

Expand Down Expand Up @@ -365,10 +365,10 @@ fn merge_solutions<'ancestor, 'ours, 'theirs, T: ?Sized + SliceLike>(

solution.push(merge_range);

if ours.map_or(true, |range| range.is_empty()) {
if ours.is_none_or(|range| range.is_empty()) {
ours = our_solution.next();
}
if theirs.map_or(true, |range| range.is_empty()) {
if theirs.is_none_or(|range| range.is_empty()) {
theirs = their_solution.next();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/patch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{
ops,
};

use crate::{utils::Text, LineEnd};
use crate::{LineEnd, utils::Text};

const NO_NEWLINE_AT_EOF: &str = "\\ No newline at end of file";

Expand Down
Loading
Loading