Unnamed repository; edit this file 'description' to name the repository.
minor: Prefer stable `core::num::abs_diff` to polyfill
This function was made stable in Rust 1.60.0 so we no longer need to polyfill.
Michael Davis 2025-02-03
parent ab6a92e · commit ebdab86
-rw-r--r--helix-view/src/gutter.rs11
1 files changed, 1 insertions, 10 deletions
diff --git a/helix-view/src/gutter.rs b/helix-view/src/gutter.rs
index 36f719f7..7cd91271 100644
--- a/helix-view/src/gutter.rs
+++ b/helix-view/src/gutter.rs
@@ -178,7 +178,7 @@ pub fn line_numbers<'doc>(
&& current_line != line;
let display_num = if relative {
- abs_diff(current_line, line)
+ current_line.abs_diff(line)
} else {
line + 1
};
@@ -226,15 +226,6 @@ pub fn padding<'doc>(
Box::new(|_line: usize, _selected: bool, _first_visual_line: bool, _out: &mut String| None)
}
-#[inline(always)]
-const fn abs_diff(a: usize, b: usize) -> usize {
- if a > b {
- a - b
- } else {
- b - a
- }
-}
-
pub fn breakpoints<'doc>(
editor: &'doc Editor,
doc: &'doc Document,