From f49cfe3ca5d1e086a5bdb16c9ea5e14cdbf9f7cd Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Thu, 3 Mar 2016 21:21:00 -0800 Subject: [PATCH] Move parse_update_count and delete util --- src/lib.rs | 1 - src/stmt.rs | 11 +++++++---- src/util.rs | 3 --- 3 files changed, 7 insertions(+), 8 deletions(-) delete mode 100644 src/util.rs diff --git a/src/lib.rs b/src/lib.rs index 7ce1b89d..36a688f5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -93,7 +93,6 @@ mod md5; mod message; mod priv_io; mod url; -mod util; pub mod error; pub mod io; pub mod notification; diff --git a/src/stmt.rs b/src/stmt.rs index 0587daa6..df7b5808 100644 --- a/src/stmt.rs +++ b/src/stmt.rs @@ -11,7 +11,6 @@ use types::{SessionInfo, Type, ToSql}; use message::FrontendMessage::*; use message::BackendMessage::*; use message::WriteMessage; -use util; use rows::{Rows, LazyRows}; use {bad_response, Connection, Transaction, StatementInternals, Result, RowsNew, InnerConnection, SessionInfoNew, LazyRowsNew, DbErrorNew, ColumnNew, StatementInfo, TransactionInternals}; @@ -140,7 +139,7 @@ impl<'conn> Statement<'conn> { return DbError::new(fields); } CommandComplete { tag } => { - num = util::parse_update_count(tag); + num = parse_update_count(tag); break; } EmptyQueryResponse => { @@ -321,7 +320,7 @@ impl<'conn> Statement<'conn> { try!(info.conn.write_messages(&[CopyDone, Sync])); let num = match try!(info.conn.read_message()) { - CommandComplete { tag } => util::parse_update_count(tag), + CommandComplete { tag } => parse_update_count(tag), ErrorResponse { fields } => { try!(info.conn.wait_for_ready()); return DbError::new(fields); @@ -421,7 +420,7 @@ impl<'conn> Statement<'conn> { } BCopyDone => {} CommandComplete { tag } => { - count = util::parse_update_count(tag); + count = parse_update_count(tag); break; } ErrorResponse { fields } => { @@ -567,3 +566,7 @@ impl Format { } } } + +fn parse_update_count(tag: String) -> u64 { + tag.split(' ').last().unwrap().parse().unwrap_or(0) +} diff --git a/src/util.rs b/src/util.rs deleted file mode 100644 index 05ccbd0a..00000000 --- a/src/util.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn parse_update_count(tag: String) -> u64 { - tag.split(' ').last().unwrap().parse().unwrap_or(0) -}