From eacb16647b1a3b7e2afc6e21bbc51dfbbea462b9 Mon Sep 17 00:00:00 2001 From: Davirain Date: Tue, 4 Jun 2024 16:17:20 +0800 Subject: [PATCH] fix clipp warnning --- rust/src/lib.rs | 3 +++ rust/src/sort/select_sort.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 0418e69..744da80 100755 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1,3 +1,6 @@ +#![allow(clippy::borrowed_box)] +#![allow(clippy::only_used_in_recursion)] + //! # Introduction to algorithms //! > thrid edition implement by rust programming //! diff --git a/rust/src/sort/select_sort.rs b/rust/src/sort/select_sort.rs index 31c94f3..e737abb 100755 --- a/rust/src/sort/select_sort.rs +++ b/rust/src/sort/select_sort.rs @@ -53,7 +53,7 @@ impl SelectSort { where F: FnOnce(Option<&T>, Option<&T>) -> bool + Copy, { - let mut smallest = self.arr.get(0); + let mut smallest = self.arr.first(); let mut smallest_index = 0usize; for i in 1..self.arr.len() { if f(self.arr.get(i), smallest) {