Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions postgres-protocol/src/authentication/sasl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl ScramSha256 {
password,
channel_binding,
} => (nonce, password, channel_binding),
_ => return Err(io::Error::new(io::ErrorKind::Other, "invalid SCRAM state")),
_ => return Err(io::Error::other("invalid SCRAM state")),
};

let message =
Expand Down Expand Up @@ -252,7 +252,7 @@ impl ScramSha256 {
salted_password,
auth_message,
} => (salted_password, auth_message),
_ => return Err(io::Error::new(io::ErrorKind::Other, "invalid SCRAM state")),
_ => return Err(io::Error::other("invalid SCRAM state")),
};

let message =
Expand All @@ -262,10 +262,7 @@ impl ScramSha256 {

let verifier = match parsed {
ServerFinalMessage::Error(e) => {
return Err(io::Error::new(
io::ErrorKind::Other,
format!("SCRAM error: {}", e),
));
return Err(io::Error::other(format!("SCRAM error: {}", e)));
}
ServerFinalMessage::Verifier(verifier) => verifier,
};
Expand Down
2 changes: 1 addition & 1 deletion postgres-protocol/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ pub fn varbit_from_sql(mut buf: &[u8]) -> Result<Varbit<'_>, StdBox<dyn Error +
if len < 0 {
return Err("invalid varbit length: varbit < 0".into());
}
let bytes = (len as usize + 7) / 8;
let bytes = (len as usize).div_ceil(8);
if buf.len() != bytes {
return Err("invalid message length: varbit mismatch".into());
}
Expand Down
2 changes: 2 additions & 0 deletions postgres/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Connection configuration.

#![allow(clippy::doc_overindented_list_items)]

use crate::connection::Connection;
use crate::Client;
use log::info;
Expand Down
3 changes: 1 addition & 2 deletions postgres/src/copy_in_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ impl Write for CopyInWriter<'_> {
}

fn flush(&mut self) -> io::Result<()> {
self.flush_inner()
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
self.flush_inner().map_err(io::Error::other)
}
}
2 changes: 1 addition & 1 deletion postgres/src/copy_out_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl BufRead for CopyOutReader<'_> {
.block_on(async { stream.next().await.transpose() })
{
Ok(Some(cur)) => self.cur = cur,
Err(e) => return Err(io::Error::new(io::ErrorKind::Other, e)),
Err(e) => return Err(io::Error::other(e)),
Ok(None) => break,
};
}
Expand Down
2 changes: 2 additions & 0 deletions tokio-postgres/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Connection configuration.

#![allow(clippy::doc_overindented_list_items)]

#[cfg(feature = "runtime")]
use crate::connect::connect;
use crate::connect_raw::connect_raw;
Expand Down