minor clippy fixes

This commit is contained in:
Eric Seppanen
2021-06-09 16:42:57 -07:00
committed by Eric Seppanen
parent 36d6c401bf
commit d2d5a01522
3 changed files with 7 additions and 7 deletions

View File

@@ -458,7 +458,8 @@ impl postgres_backend::Handler for PageServerHandler {
.parse()?;
let timeline = page_cache::get_repository().get_timeline(timeline_id)?;
let postgres_connection_uri = it.next().ok_or(anyhow!("missing postgres uri"))?;
let postgres_connection_uri =
it.next().ok_or_else(|| anyhow!("missing postgres uri"))?;
let mut conn = postgres::Client::connect(postgres_connection_uri, postgres::NoTls)?;
let mut copy_in = conn.copy_in(format!("push {}", timeline_id.to_string()).as_str())?;

View File

@@ -68,7 +68,7 @@ impl GarbageCollector {
fn was_deleted(&self, key: &[u8]) -> bool {
let key = key.to_vec();
let mut garbage = self.garbage.lock().unwrap();
return garbage.remove(&key);
garbage.remove(&key)
}
}
@@ -198,9 +198,9 @@ impl ObjectStore for RocksObjectStore {
));
Ok(Box::new(RocksObjects {
iter,
timeline,
lsn,
iter,
}))
}
}

View File

@@ -93,10 +93,9 @@ impl FeMessage {
let len = stream.read_u32::<BE>()?;
// The message length includes itself, so it better be at least 4
let bodylen = len.checked_sub(4).ok_or(io::Error::new(
io::ErrorKind::InvalidInput,
"invalid message length: parsing u32",
))?;
let bodylen = len
.checked_sub(4)
.ok_or_else(|| anyhow!("invalid message length: parsing u32"))?;
// Read message body
let mut body_buf: Vec<u8> = vec![0; bodylen as usize];