diff options
| author | bors <bors@rust-lang.org> | 2025-03-28 06:28:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-03-28 06:28:48 +0000 |
| commit | e77a8f439cc87c5d67b007e9811578533de1de91 (patch) | |
| tree | 61ed07fb4f969f80703432b0c0cebee9d7a1a7a8 /compiler/rustc_span/src | |
| parent | 3f690c2257b7080cd3a8cce64e082fc972148990 (diff) | |
| parent | 63718922df76dac4be1c6d5d5e24867f090f7de0 (diff) | |
| download | rust-e77a8f439cc87c5d67b007e9811578533de1de91.tar.gz rust-e77a8f439cc87c5d67b007e9811578533de1de91.zip | |
Auto merge of #139037 - jhpratt:rollup-4c74y8a, r=jhpratt
Rollup of 6 pull requests Successful merges: - #138720 (Specify a concrete stack size in channel tests) - #139010 (Improve `xcrun` error handling) - #139021 (std: get rid of pre-Vista fallback code) - #139025 (Do not trim paths in MIR validator) - #139026 (Use `abs_diff` where applicable) - #139030 (saethlin goes on vacation) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_span/src')
| -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 |
