Ver código fonte

Address clippy suggestions.

Jing Yang 9 meses atrás
pai
commit
c01678e644
2 arquivos alterados com 3 adições e 2 exclusões
  1. 2 1
      raft/src/verify_authority.rs
  2. 1 1
      test_configs/src/kvraft/config.rs

+ 2 - 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()
@@ -504,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();

+ 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);