Skip to content

Commit 81f06b8

Browse files
committed
misc: clippy
Signed-off-by: Anthony Griffon <[email protected]>
1 parent 7f8ca77 commit 81f06b8

File tree

9 files changed

+36
-36
lines changed

9 files changed

+36
-36
lines changed

app/roster/src/application/server/cmd/set.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ use std::time::Duration;
22

33
use bytes::Bytes;
44
use bytestring::ByteString;
5-
use crc::{Crc, CRC_16_XMODEM};
5+
66

77
use super::parse::{Parse, ParseError};
88
use super::CommandExecution;
99
use crate::application::server::connection::WriteConnection;
1010
use crate::application::server::context::Context;
1111
use crate::application::server::frame::Frame;
12-
use crate::application::server::{crc_hash, CRC};
12+
use crate::application::server::{crc_hash};
1313
use crate::domain::storage::SetOptions;
1414

1515
/// Set key to hold the string value. If key already holds a value, it is

app/roster/src/application/server/connection.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::fmt::Debug;
22
use std::io::{self, Cursor};
3-
use std::rc::Rc;
3+
44

55
use bytes::BytesMut;
66
use monoio::buf::IoBuf;

app/roster/src/application/server/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl Context {
2222
self.storage.is_in_slot(hash)
2323
}
2424

25-
pub fn slot_nb(&self, hash: u16) -> Option<usize> {
25+
pub fn slot_nb(&self, _hash: u16) -> Option<usize> {
2626
todo!()
2727
// self.storage.slot_nb(hash)
2828
}

app/roster/src/application/server/handle.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use std::cell::RefCell;
2-
use std::os::fd::{AsRawFd, IntoRawFd};
2+
use std::os::fd::{IntoRawFd};
33
use std::rc::Rc;
44
use std::time::Duration;
55

6-
use monoio::net::TcpStream;
7-
use monoio::time::Instant;
6+
7+
88
use sharded_thread::shard::Shard;
99

1010
use super::cmd::Command;

app/roster/src/application/server/mod.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
//! The whole redis server implementation is here.
22
use std::net::SocketAddr;
3-
use std::os::fd::{FromRawFd, RawFd};
4-
use std::rc::Rc;
3+
4+
55
use std::sync::atomic::AtomicU16;
66
use std::sync::Arc;
77
use std::thread::JoinHandle;
88

99
use crc::{Crc, CRC_16_XMODEM};
1010
use derive_builder::Builder;
11-
use futures::StreamExt;
12-
use monoio::net::{ListenerConfig, TcpListener, TcpStream};
11+
12+
1313

1414
mod connection;
1515
mod context;
1616
pub mod frame;
1717
pub(crate) mod handle;
18-
use handle::Handler;
19-
use monoio::time::Instant;
20-
use sharded_thread::shard::Shard;
18+
19+
20+
2121

2222
mod cmd;
2323
mod server_thread;
2424

2525
use self::server_thread::ServerMonoThreadedHandle;
26-
use crate::application::server::connection::WriteConnection;
27-
use crate::application::server::context::Context;
26+
27+
2828
use crate::application::server::handle::ConnectionMsg;
29-
use crate::domain;
30-
use crate::domain::dialer::{Dialer, RootDialer, Slot};
29+
30+
use crate::domain::dialer::{RootDialer, Slot};
3131
use crate::domain::storage::Storage;
3232

3333
#[derive(Debug, Builder, Clone)]

app/roster/src/application/server/server_thread.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::rc::Rc;
22
use std::thread::JoinHandle;
33

4-
use futures::future::Join;
5-
use monoio::net::{ListenerConfig, TcpListener, TcpStream};
4+
5+
use monoio::net::{ListenerConfig, TcpListener};
66

77
use super::ServerConfig;
88
use crate::application::server::connection::WriteConnection;
@@ -43,7 +43,7 @@ impl ServerMonoThreadedHandle {
4343
cpu: usize,
4444
storage: &Storage,
4545
) -> Self {
46-
let (slot, storage_segment) = storage.part(cpu as u16);
46+
let (_slot, storage_segment) = storage.part(cpu as u16);
4747
let dialer = dialer.part(cpu as u16).unwrap();
4848

4949
Self {
@@ -55,7 +55,9 @@ impl ServerMonoThreadedHandle {
5555
}
5656

5757
pub fn initialize(self) -> JoinHandle<()> {
58-
let handle = std::thread::spawn(move || {
58+
59+
60+
std::thread::spawn(move || {
5961
monoio::utils::bind_to_cpu_set(Some(self.cpu)).unwrap();
6062

6163
let mut rt = monoio::RuntimeBuilder::<Driver>::new()
@@ -111,8 +113,6 @@ impl ServerMonoThreadedHandle {
111113
#[allow(unreachable_code)]
112114
Ok::<(), anyhow::Error>(())
113115
});
114-
});
115-
116-
handle
116+
})
117117
}
118118
}

app/roster/src/domain/dialer/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::ops::{Deref, Range};
2-
use std::rc::Rc;
3-
use std::sync::Arc;
2+
3+
44

55
use sharded_thread::mesh::MeshBuilder;
66
use sharded_thread::shard::Shard;

app/roster/src/domain/storage/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Storage primitive which is used to interact with Keys
22
33
use std::hash::BuildHasherDefault;
4-
use std::ops::Range;
5-
use std::rc::Rc;
4+
5+
66
use std::sync::atomic::AtomicU32;
77
use std::sync::Arc;
88

@@ -68,7 +68,7 @@ impl StorageSegment {
6868
val,
6969
};
7070

71-
let old = self
71+
let _old = self
7272
.count
7373
.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
7474
/*
@@ -141,14 +141,14 @@ impl Storage {
141141
// We generate the Slot where we need to create a StorageSegment.
142142
let mut slots: Vec<(Slot, StorageSegment)> = Vec::new();
143143
for slot in 0..nb_slot {
144-
let part_size: u16 = HASH_SLOT_MAX / nb_slot as u16;
145-
let remainder: u16 = HASH_SLOT_MAX % nb_slot as u16;
144+
let part_size: u16 = HASH_SLOT_MAX / nb_slot;
145+
let remainder: u16 = HASH_SLOT_MAX % nb_slot;
146146

147-
let start = slot as u16 * part_size as u16;
147+
let start = slot * part_size;
148148
let end = if slot == nb_slot - 1 {
149-
(slot as u16 + 1) * part_size + remainder as u16
149+
(slot + 1) * part_size + remainder
150150
} else {
151-
(slot as u16 + 1) * part_size as u16
151+
(slot + 1) * part_size
152152
};
153153

154154
let slot = Slot::from(start..end);

app/roster/tests/utils/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::net::SocketAddr;
2-
use std::str::FromStr;
2+
33

44
mod port_picker;
55

0 commit comments

Comments
 (0)