Fix a few clippy warnings.

By either accepting clippy's suggestion, or by adding an 'allow'
directive to silence it.
This commit is contained in:
Heikki Linnakangas
2021-05-06 21:57:13 +03:00
parent 61af9bb889
commit 77fd24b950
4 changed files with 15 additions and 10 deletions

View File

@@ -663,7 +663,7 @@ impl Connection {
debug!("process query {:?}", query_string);
// remove null terminator, if any
let mut query_string = query_string.clone();
let mut query_string = query_string;
if query_string.last() == Some(&0) {
query_string.truncate(query_string.len() - 1);
}

View File

@@ -171,6 +171,11 @@ pub fn ui_main() -> Result<(), Box<dyn Error>> {
})?;
// If ther user presses 'q', quit.
// silence clippy's suggestion to rewrite this as an if-statement. Match
// makes more sense as soon as we get another command than 'q'.
#[allow(clippy::single_match)]
#[allow(clippy::collapsible_match)]
if let Event::Input(key) = events.next()? {
match key {
Key::Char('q') => {

View File

@@ -215,13 +215,13 @@ fn walreceiver_main(
waldecoder.feed_bytes(data);
loop {
if let Some((lsn, recdata)) = waldecoder.poll_decode()? {
let decoded = decode_wal_record(recdata.clone());
timeline.save_decoded_record(decoded, recdata, lsn)?;
} else {
break;
}
while let Some((lsn, recdata)) = waldecoder.poll_decode()? {
let decoded = decode_wal_record(recdata.clone());
timeline.save_decoded_record(decoded, recdata, lsn)?;
// Now that this record has been handled, let the page cache know that
// it is up-to-date to this LSN
timeline.advance_last_record_lsn(lsn);
}
// Update the last_valid LSN value in the page cache one more time. We updated
@@ -317,7 +317,7 @@ pub fn identify_system(
dbname: get_parse(first_row, 3).ok(),
})
} else {
Err(IdentifyError)?
Err(IdentifyError.into())
}
}

View File

@@ -435,7 +435,7 @@ impl WalRedoProcess {
&self,
tag: BufferTag,
base_img: Option<Bytes>,
records: &Vec<WALRecord>,
records: &[WALRecord],
) -> Result<Bytes, std::io::Error> {
let mut stdin = self.stdin.borrow_mut();
let mut stdout = self.stdout.borrow_mut();