From ebdab86ce61632a6c7ac024f75fa200b0db1dcea Mon Sep 17 00:00:00 2001 From: Michael Davis <mcarsondavis@gmail.com> Date: Sun, 2 Feb 2025 20:21:16 -0500 Subject: [PATCH] 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. --- helix-view/src/gutter.rs | 11 +---------- 1 file changed, 1 insertion(+), 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,