Ver Fonte

Fix clippy errors.

Jing Yang há 5 anos atrás
pai
commit
74a8a108ea
3 ficheiros alterados com 4 adições e 2 exclusões
  1. 2 2
      src/lib.rs
  2. 1 0
      src/log_array.rs
  3. 1 0
      src/utils.rs

+ 2 - 2
src/lib.rs

@@ -790,7 +790,7 @@ where
         // To send AppendEntries request, next_index must be strictly larger
         // than start(). Otherwise we won't be able to know the log term of the
         // entry right before next_index.
-        return if rf.next_index[peer_index] > rf.log.start() {
+        if rf.next_index[peer_index] > rf.log.start() {
             SyncLogEntryOperation::AppendEntries(Self::build_append_entries(
                 &rf, peer_index,
             ))
@@ -798,7 +798,7 @@ where
             SyncLogEntryOperation::InstallSnapshot(
                 Self::build_install_snapshot(&rf),
             )
-        };
+        }
     }
 
     fn build_append_entries(

+ 1 - 0
src/log_array.rs

@@ -251,6 +251,7 @@ impl<C> LogArray<C> {
         self.offset(index)
     }
 
+    #[allow(clippy::len_zero)]
     fn check_one_element(&self) {
         assert!(
             self.inner.len() >= 1,

+ 1 - 0
src/utils.rs

@@ -15,6 +15,7 @@ where
             tokio::time::sleep(Duration::from_millis((1 << i) * 10)).await;
         }
         // Not timed-out.
+        #[allow(clippy::collapsible_match)]
         if let Ok(reply) = tokio::time::timeout(deadline, task_gen(i)).await {
             // And no error
             if let Ok(reply) = reply {