about summary refs log tree commit diff
path: root/compiler/rustc_span
diff options
context:
space:
mode:
authorFolkert de Vries <folkert@folkertdev.nl>2025-07-05 08:36:27 +0200
committerFolkert de Vries <folkert@folkertdev.nl>2025-07-05 10:55:42 +0200
commited3711ea29398b09483e4e2a3930567e9ba81d93 (patch)
tree58de9f15513d65c6fc1bf3cd61132ae046706e37 /compiler/rustc_span
parent226b0fbe11812c71c8002b10a40063571cf52b3f (diff)
downloadrust-ed3711ea29398b09483e4e2a3930567e9ba81d93.tar.gz
rust-ed3711ea29398b09483e4e2a3930567e9ba81d93.zip
use `div_ceil` instead of manual logic
Diffstat (limited to 'compiler/rustc_span')
-rw-r--r--compiler/rustc_span/src/edit_distance.rs2
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 4f3202b694c..416e9daa8fb 100644
--- a/compiler/rustc_span/src/edit_distance.rs
+++ b/compiler/rustc_span/src/edit_distance.rs
@@ -130,7 +130,7 @@ pub fn edit_distance_with_substrings(a: &str, b: &str, limit: usize) -> Option<u
         1 // Exact substring match, but not a total word match so return non-zero
     } else if !big_len_diff {
         // Not a big difference in length, discount cost of length difference
-        score + (len_diff + 1) / 2
+        score + len_diff.div_ceil(2)
     } else {
         // A big difference in length, add back the difference in length to the score
         score + len_diff