Fix clippy warnings remove unused imports

This commit is contained in:
Devin Ragotzy 2021-01-05 09:21:41 -05:00 committed by Timo Kösters
parent 0ee239c9d7
commit 7c4d74bf9b
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
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()
};
@ -156,7 +156,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)
@ -185,7 +185,7 @@ impl Sending {
}
let mut prefix = if *is_appservice {
"+".as_bytes().to_vec()
b"+".to_vec()
} else {
Vec::new()
};
@ -219,7 +219,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);
@ -329,7 +329,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)