Skip to content

Commit 5bfd8f8

Browse files
committed
clippy fixes
1 parent 5643fbd commit 5bfd8f8

File tree

6 files changed

+13
-16
lines changed

6 files changed

+13
-16
lines changed

omnipaxos/src/omni_paxos.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ impl ClusterConfig {
152152
/// Configuration for a singular `OmniPaxos` instance in a cluster.
153153
/// # Fields
154154
/// * `pid`: The unique identifier of this node. Must not be 0.
155-
/// * `election_tick_timeout`: The number of calls to `tick()` before leader election is updated.
156-
/// If this is set to 5 and `tick()` is called every 10ms, then the election timeout will be 50ms. Must not be 0.
155+
/// * `election_tick_timeout`: The number of calls to `tick()` before leader election is updated. If this is set to 5 and `tick()` is called every 10ms, then the election timeout will be 50ms. Must not be 0.
157156
/// * `resend_message_tick_timeout`: The number of calls to `tick()` before a message is considered dropped and thus resent. Must not be 0.
158157
/// * `buffer_size`: The buffer size for outgoing messages.
159158
/// * `batch_size`: The size of the buffer for log batching. The default is 1, which means no batching.

omnipaxos/src/unicache/lfu/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,18 @@ impl<K: Hash + Eq + Clone, V> LFUCache<K, V> {
8686
/// Method marked as mutable because it internally updates the frequency of the accessed key
8787
pub fn get(&mut self, key: &K) -> Option<&V> {
8888
self.update_frequency_bin(key);
89-
self.values.get(&key).map(|x| &x.value)
89+
self.values.get(key).map(|x| &x.value)
9090
}
9191

9292
pub fn get_mut(&mut self, key: &K) -> Option<&mut V> {
9393
self.update_frequency_bin(key);
94-
self.values.get_mut(&key).map(|x| &mut x.value)
94+
self.values.get_mut(key).map(|x| &mut x.value)
9595
}
9696

9797
fn update_frequency_bin(&mut self, key: &K) {
98-
if let Some(value_counter) = self.values.get_mut(&key) {
98+
if let Some(value_counter) = self.values.get_mut(key) {
9999
let bin = self.frequency_bin.get_mut(&value_counter.count).unwrap();
100-
bin.0.remove(&key);
100+
bin.0.remove(key);
101101
let count = value_counter.count;
102102
value_counter.inc();
103103
if count == self.min_frequency && bin.0.is_empty() {

omnipaxos/src/unicache/lfu/serialization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ where
1313
{
1414
let len = self.0.len();
1515
let mut seq = serializer.serialize_seq(Some(len))?;
16-
let _ = self.0.iter().for_each(|item| {
16+
self.0.iter().for_each(|item| {
1717
seq.serialize_element(&item).unwrap();
1818
});
1919
seq.end()

omnipaxos/src/unicache/lfu_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ where
5252
}
5353

5454
fn try_encode(&mut self, field: &Encodable) -> MaybeEncoded<Encodable, Encoded> {
55-
match self.lfu_cache_encoder.get(&field) {
55+
match self.lfu_cache_encoder.get(field) {
5656
Some(encoding) => MaybeEncoded::<Encodable, Encoded>::Encoded(encoding.clone()),
5757
None => {
5858
if self.lfu_cache_encoder.len() == self.size {

omnipaxos/src/unicache/lru_cache.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ where
9898
}
9999

100100
fn try_encode(&mut self, field: &Encodable) -> MaybeEncoded<Encodable, Encoded> {
101-
match self.lru_cache_encoder.get(&field) {
101+
match self.lru_cache_encoder.get(field) {
102102
Some(encoding) => MaybeEncoded::<Encodable, Encoded>::Encoded(encoding.clone()),
103103
None => {
104104
if self.lru_cache_encoder.len() == self.size {
@@ -159,7 +159,7 @@ mod serialization {
159159
{
160160
let len = self.0.len();
161161
let mut seq = serializer.serialize_seq(Some(len))?;
162-
let _ = self.0.iter().rev().for_each(|item| {
162+
self.0.iter().rev().for_each(|item| {
163163
seq.serialize_element(&item).unwrap();
164164
});
165165
seq.end()
@@ -185,8 +185,8 @@ mod serialization {
185185
impl<Encodable, Encoded> LruWrapperVisitor<Encodable, Encoded> {
186186
fn new() -> Self {
187187
Self {
188-
_k: PhantomData::default(),
189-
_v: PhantomData::default(),
188+
_k: PhantomData,
189+
_v: PhantomData,
190190
}
191191
}
192192
}

omnipaxos_macros/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ pub fn entry_derive(input: TokenStream) -> TokenStream {
4040
///
4141
/// # Attributes
4242
/// * `encoding(T)`: (Optional) The type for what the annotated field should be encoded as. The default is `u8`.
43-
/// * `size(usize)`: (Optional) The size of the cache for this field. Should not be larger than the max size of the encoding type, e.g., if `encoding(u8)` is used, the max size should be 255.
44-
/// The default value is `u8::MAX`.
45-
/// * `cache(C)`: (Optional) The cache implementation which is a type `C: UniCache`. To use one of the provided implementations, simply use `cache(lru)` or `cache(lfu)`.
46-
/// The default uses `lru` (least-recently-used) eviction policy.
43+
/// * `size(usize)`: (Optional) The size of the cache for this field. Should not be larger than the max size of the encoding type, e.g., if `encoding(u8)` is used, the max size should be 255. Default is u8::MAX.
44+
/// * `cache(C)`: (Optional) The cache implementation which is a type `C: UniCache`. `cache(lru)` or `cache(lfu)` are provided out of the box. The default is `lru` (least-recently-used) eviction policy.
4745
///
4846
/// ## Usage
4947
///

0 commit comments

Comments
 (0)