Fix clippy warnings remove unused imports
This commit is contained in:
parent
63af3d3da0
commit
cdeb1236a2
7 changed files with 39 additions and 34 deletions
|
@ -9,9 +9,11 @@ use trust_dns_resolver::TokioAsyncResolver;
|
|||
|
||||
pub const COUNTER: &str = "c";
|
||||
|
||||
pub type DestinationCache = Arc<RwLock<HashMap<Box<ServerName>, (String, Option<String>)>>>;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Globals {
|
||||
pub actual_destination_cache: Arc<RwLock<HashMap<Box<ServerName>, (String, Option<String>)>>>, // actual_destination, host
|
||||
pub actual_destination_cache: DestinationCache, // actual_destination, host
|
||||
pub(super) globals: sled::Tree,
|
||||
config: Config,
|
||||
keypair: Arc<ruma::signatures::Ed25519KeyPair>,
|
||||
|
|
|
@ -79,7 +79,7 @@ impl Sending {
|
|||
match response {
|
||||
Ok((server, is_appservice)) => {
|
||||
let mut prefix = if is_appservice {
|
||||
"+".as_bytes().to_vec()
|
||||
b"+".to_vec()
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
|
@ -125,7 +125,7 @@ impl Sending {
|
|||
Err((server, is_appservice, e)) => {
|
||||
info!("Couldn't send transaction to {}\n{}", server, e);
|
||||
let mut prefix = if is_appservice {
|
||||
"+".as_bytes().to_vec()
|
||||
b"+".to_vec()
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
|
@ -157,7 +157,7 @@ impl Sending {
|
|||
.map_err(|_| Error::bad_database("ServerName in servernamepduid bytes are invalid."))
|
||||
.map(|server_str| {
|
||||
// Appservices start with a plus
|
||||
if server_str.starts_with("+") {
|
||||
if server_str.starts_with('+') {
|
||||
(server_str[1..].to_owned(), true)
|
||||
} else {
|
||||
(server_str, false)
|
||||
|
@ -186,7 +186,7 @@ impl Sending {
|
|||
}
|
||||
|
||||
let mut prefix = if *is_appservice {
|
||||
"+".as_bytes().to_vec()
|
||||
b"+".to_vec()
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
|
@ -220,7 +220,7 @@ impl Sending {
|
|||
}
|
||||
|
||||
pub fn send_pdu_appservice(&self, appservice_id: &str, pdu_id: &[u8]) -> Result<()> {
|
||||
let mut key = "+".as_bytes().to_vec();
|
||||
let mut key = b"+".to_vec();
|
||||
key.extend_from_slice(appservice_id.as_bytes());
|
||||
key.push(0xff);
|
||||
key.extend_from_slice(pdu_id);
|
||||
|
@ -330,7 +330,7 @@ impl Sending {
|
|||
})?;
|
||||
|
||||
// Appservices start with a plus
|
||||
let (server, is_appservice) = if server.starts_with("+") {
|
||||
let (server, is_appservice) = if server.starts_with('+') {
|
||||
(&server[1..], true)
|
||||
} else {
|
||||
(&*server, false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue