From 4b130fc57ccdc556ca5cb48eac6a54efae65de3d Mon Sep 17 00:00:00 2001
From: licunlong <licunlong1@huawei.com>
Date: Tue, 27 Jun 2023 20:38:48 +0800
Subject: [PATCH] typo: fix some clippy

---
 libs/basic/src/logger.rs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libs/basic/src/logger.rs b/libs/basic/src/logger.rs
index 3bf579b..06f4ff2 100644
--- a/libs/basic/src/logger.rs
+++ b/libs/basic/src/logger.rs
@@ -201,7 +201,6 @@ impl FileLogger {
         /* 3. Write message */
         if let Err(e) = file.write((msg + "\n").as_bytes()) {
             println!("Failed to log message: {e}");
-            return;
         }
     }
 
@@ -235,13 +234,13 @@ impl FileLogger {
             num_list.push(rotated_num);
         }
 
-        num_list.sort();
+        num_list.sort_unstable();
 
         /* 1. delete surplus rotated file */
         /* We only keep (file_number - 1) rotated files, because we will generate a new one later. */
         let file_number = self.file_number as usize;
-        for i in file_number - 1..num_list.len() {
-            let src = String::from(&file_name_dot) + &num_list[i].to_string();
+        for rotated_num in num_list.iter().skip(file_number - 1) {
+            let src = String::from(&file_name_dot) + &rotated_num.to_string();
             Self::mv_file_in_dir(&src, None, dir);
         }
 
-- 
2.33.0

