3 Commits f5ff46482a ... c01678e644

Auteur SHA1 Message Date
  Jing Yang c01678e644 Address clippy suggestions. il y a 9 mois
  Jing Yang 93f6b20b3f Update dependencies. il y a 9 mois
  Jing Yang 58369ffd9f Address clippy suggestions. il y a 2 ans

Fichier diff supprimé car celui-ci est trop grand
+ 195 - 199
durio/Cargo.lock


+ 1 - 1
raft/src/storage/decode_and_encode.rs

@@ -12,7 +12,7 @@ pub(crate) fn encode_log_entry<Command: Serialize>(
 pub(crate) fn decode_log_entry<'a, Command: Deserialize<'a>>(
     stored: &'a [u8],
 ) -> LogEntry<Command> {
-    bincode::deserialize(&stored).expect("Deserialization should never fail")
+    bincode::deserialize(stored).expect("Deserialization should never fail")
 }
 
 pub(crate) fn encode_voted_for(voted_for: &Option<Peer>) -> String {

+ 1 - 1
raft/src/storage/mod.rs

@@ -101,7 +101,7 @@ pub trait RaftStorageTrait {
     /// Whether or not this storage system requires log compaction. Any
     /// non-experimental storage must require log compaction.
     fn log_compaction_required(&self) -> bool {
-        return true;
+        true
     }
 
     /// Returns a monitor that helps Raft decide when a compaction should happen

+ 1 - 1
raft/src/utils/do_nothing.rs

@@ -77,7 +77,7 @@ pub struct DoNothingRaftStorageMonitor;
 
 impl RaftStorageMonitorTrait for DoNothingRaftStorageMonitor {
     fn should_compact_log_now(&self) -> bool {
-        return false;
+        false
     }
 }
 

+ 3 - 1
raft/src/verify_authority.rs

@@ -312,7 +312,7 @@ impl VerifyAuthorityDaemon {
             |head: &VerifyAuthorityToken| head.rough_time < expiring_line;
         // Note rough_time might not be in increasing order, so we might still
         // have requests that are expired in the queue after the sweep.
-        while state.queue.front().map_or(false, expired) {
+        while state.queue.front().is_some_and(expired) {
             state
                 .queue
                 .pop_front()
@@ -480,6 +480,7 @@ mod tests {
         {
             let state = daemon.state.lock();
             assert_eq!(1, state.queue.len());
+            #[allow(clippy::get_first)]
             let token = state.queue.get(0).unwrap();
             assert_eq!(
                 [Beat(11), Beat(9), Beat(7), Beat(5), Beat(3)],
@@ -503,6 +504,7 @@ mod tests {
             assert_eq!(COMMIT_INDEX + 10, token.commit_index);
         }
     }
+
     #[test]
     fn test_verify_authority_async_term_mismatch() {
         let daemon = init_daemon();

+ 2 - 2
test_configs/src/in_memory_storage.rs

@@ -127,7 +127,7 @@ impl RaftStorageMonitorTrait for InMemoryStorageMonitor {
     fn should_compact_log_now(&self) -> bool {
         let stored = self.stored.0.lock();
         let total_size = stored.total_size();
-        return total_size > self.max_state_bytes;
+        total_size > self.max_state_bytes
     }
 }
 
@@ -242,7 +242,7 @@ mod tests {
             Self {
                 index,
                 amount: index as f64 * 7.0,
-                description: char::from('a' as u8 + index as u8).to_string(),
+                description: char::from(b'a' + index as u8).to_string(),
             }
         }
     }

+ 1 - 1
test_configs/src/kvraft/config.rs

@@ -89,7 +89,7 @@ impl Config {
             .position(|index| {
                 state.kv_servers[*index]
                     .as_ref()
-                    .map_or(false, |kv| kv.raft().get_state().1)
+                    .is_some_and(|kv| kv.raft().get_state().1)
             })
             .unwrap_or(0);
         indexes.swap(0, leader_position);

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff