diff options
| author | Yotam Ofek <yotam.ofek@gmail.com> | 2025-03-27 18:29:06 +0000 |
|---|---|---|
| committer | Yotam Ofek <yotam.ofek@gmail.com> | 2025-03-27 18:29:06 +0000 |
| commit | bec69704c0ee6b3c6b1854b104b964fc17d8c36f (patch) | |
| tree | 8ed4458e96863f66c9a639e66fe7dd3d4210f7a8 /compiler/rustc_span/src/edit_distance.rs | |
| parent | ecb170afc878648c3ae355dbd596c8e4b6f7ebdc (diff) | |
| download | rust-bec69704c0ee6b3c6b1854b104b964fc17d8c36f.tar.gz rust-bec69704c0ee6b3c6b1854b104b964fc17d8c36f.zip | |
Use `abs_diff` where applicable
Diffstat (limited to 'compiler/rustc_span/src/edit_distance.rs')
| -rw-r--r-- | compiler/rustc_span/src/edit_distance.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_span/src/edit_distance.rs b/compiler/rustc_span/src/edit_distance.rs index 8a2baaa42e2..4f3202b694c 100644 --- a/compiler/rustc_span/src/edit_distance.rs +++ b/compiler/rustc_span/src/edit_distance.rs @@ -118,7 +118,7 @@ pub fn edit_distance_with_substrings(a: &str, b: &str, limit: usize) -> Option<u // Check one isn't less than half the length of the other. If this is true then there is a // big difference in length. let big_len_diff = (n * 2) < m || (m * 2) < n; - let len_diff = if n < m { m - n } else { n - m }; + let len_diff = m.abs_diff(n); let distance = edit_distance(a, b, limit + len_diff)?; // This is the crux, subtracting length difference means exact substring matches will now be 0 |
