From e6c32c7b926da6b7c766dc8ed32c45debc5e17a4 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Tue, 19 Aug 2025 11:28:44 -0400 Subject: [PATCH] nil/copy: Use saturating_sub() instead of doing it manually Reviewed-by: Karol Herbst Part-of: --- src/nouveau/nil/copy.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/nouveau/nil/copy.rs b/src/nouveau/nil/copy.rs index f4f706138de..6d93e34198b 100644 --- a/src/nouveau/nil/copy.rs +++ b/src/nouveau/nil/copy.rs @@ -321,11 +321,7 @@ fn chunk_range( chunk_len: u32, ) -> Range { debug_assert!(chunk_start < whole.end); - let start = if chunk_start < whole.start { - whole.start - chunk_start - } else { - 0 - }; + let start = whole.start.saturating_sub(chunk_start); let end = std::cmp::min(whole.end - chunk_start, chunk_len); start..end }