Skip to content

Commit 1270524

Browse files
committed
Fix new clippy warnings
1 parent eb18cbd commit 1270524

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

tokio-postgres/src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ impl<'a> Parser<'a> {
489489
}
490490

491491
fn skip_ws(&mut self) {
492-
self.take_while(|c| c.is_whitespace());
492+
self.take_while(char::is_whitespace);
493493
}
494494

495495
fn take_while<F>(&mut self, f: F) -> &'a str

tokio-postgres/src/error/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ impl Error {
413413
pub fn code(&self) -> Option<&SqlState> {
414414
self.source()
415415
.and_then(|e| e.downcast_ref::<DbError>())
416-
.map(|e| e.code())
416+
.map(DbError::code)
417417
}
418418

419419
fn new(kind: Kind, cause: Option<Box<dyn error::Error + Sync + Send>>) -> Error {

tokio-postgres/src/proto/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl Client {
154154

155155
pub fn prepare(&self, name: String, query: &str, param_types: &[Type]) -> PrepareFuture {
156156
let pending = self.pending(|buf| {
157-
frontend::parse(&name, query, param_types.iter().map(|t| t.oid()), buf)
157+
frontend::parse(&name, query, param_types.iter().map(Type::oid), buf)
158158
.map_err(Error::parse)?;
159159
frontend::describe(b'S', &name, buf).map_err(Error::parse)?;
160160
frontend::sync(buf);

tokio-postgres/src/types/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ impl<'a> FromSql<'a> for &'a [u8] {
386386

387387
impl<'a> FromSql<'a> for String {
388388
fn from_sql(_: &Type, raw: &'a [u8]) -> Result<String, Box<dyn Error + Sync + Send>> {
389-
types::text_from_sql(raw).map(|b| b.to_owned())
389+
types::text_from_sql(raw).map(ToString::to_string)
390390
}
391391

392392
fn accepts(ty: &Type) -> bool {

0 commit comments

Comments
 (0)