Fix clippy warnings remove unused imports

This commit is contained in:
Devin Ragotzy 2021-01-05 09:21:41 -05:00
parent 63af3d3da0
commit cdeb1236a2
7 changed files with 39 additions and 34 deletions

View file

@ -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)