diff --git a/codegen/src/main.rs b/codegen/src/main.rs index 4ba5681b..bd1cdd73 100644 --- a/codegen/src/main.rs +++ b/codegen/src/main.rs @@ -1,8 +1,9 @@ +extern crate linked_hash_map; +extern crate marksman_escape; extern crate phf_codegen; extern crate regex; -extern crate marksman_escape; -extern crate linked_hash_map; +#[allow(unused_imports)] use std::ascii::AsciiExt; use std::path::Path; diff --git a/codegen/src/type_gen.rs b/codegen/src/type_gen.rs index 70f206db..81b356b3 100644 --- a/codegen/src/type_gen.rs +++ b/codegen/src/type_gen.rs @@ -1,8 +1,9 @@ use regex::Regex; +#[allow(unused_imports)] use std::ascii::AsciiExt; use std::collections::BTreeMap; use std::fs::File; -use std::io::{Write, BufWriter}; +use std::io::{BufWriter, Write}; use std::path::Path; use marksman_escape::Escape; @@ -164,12 +165,13 @@ pub enum Inner {{" } fn make_impl(w: &mut BufWriter, types: &BTreeMap) { - write!(w, -"impl Inner {{ + write!( + w, + "impl Inner {{ pub fn from_oid(oid: Oid) -> Option {{ match oid {{ ", - ).unwrap(); + ).unwrap(); for (oid, type_) in types { write!( @@ -181,15 +183,16 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { ).unwrap(); } - write!(w, -" _ => None, + write!( + w, + " _ => None, }} }} pub fn oid(&self) -> Oid {{ match *self {{ ", - ).unwrap(); + ).unwrap(); for (oid, type_) in types { @@ -202,15 +205,16 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { ).unwrap(); } - write!(w, -" Inner::Other(ref u) => u.oid, + write!( + w, + " Inner::Other(ref u) => u.oid, }} }} pub fn kind(&self) -> &Kind {{ match *self {{ ", - ).unwrap(); + ).unwrap(); for type_ in types.values() { let kind = match type_.kind { @@ -232,15 +236,16 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { ).unwrap(); } - write!(w, -r#" Inner::Other(ref u) => &u.kind, + write!( + w, + r#" Inner::Other(ref u) => &u.kind, }} }} pub fn name(&self) -> &str {{ match *self {{ "#, - ).unwrap(); + ).unwrap(); for type_ in types.values() { write!( @@ -263,25 +268,26 @@ r#" Inner::Other(ref u) => &u.kind, } fn make_consts(w: &mut BufWriter, types: &BTreeMap) { - write!(w, -"pub mod consts {{ + write!( + w, + "pub mod consts {{ use types::Type; use types::type_gen::Inner; ", - ).unwrap(); + ).unwrap(); for type_ in types.values() { - write!(w, -" + write!( + w, + " /// {docs} pub const {ident}: Type = Type(Inner::{variant}); ", - docs = type_.doc, - ident = type_.ident, - variant = type_.variant).unwrap(); + docs = type_.doc, + ident = type_.ident, + variant = type_.variant + ).unwrap(); } - write!(w, -"}}" - ).unwrap(); + write!(w, "}}").unwrap(); } diff --git a/postgres-shared/src/rows.rs b/postgres-shared/src/rows.rs index 3320415e..f6b1e47f 100644 --- a/postgres-shared/src/rows.rs +++ b/postgres-shared/src/rows.rs @@ -1,5 +1,6 @@ use fallible_iterator::FallibleIterator; use postgres_protocol::message::backend::DataRowBody; +#[allow(unused_imports)] use std::ascii::AsciiExt; use std::io; use std::ops::Range; @@ -43,9 +44,8 @@ impl Sealed for str { // FIXME ASCII-only case insensitivity isn't really the right thing to // do. Postgres itself uses a dubious wrapper around tolower and JDBC // uses the US locale. - stmt.iter().position( - |d| d.name().eq_ignore_ascii_case(self), - ) + stmt.iter() + .position(|d| d.name().eq_ignore_ascii_case(self)) } } diff --git a/postgres/Cargo.toml b/postgres/Cargo.toml index bf8a5f7e..bbd599e0 100644 --- a/postgres/Cargo.toml +++ b/postgres/Cargo.toml @@ -58,8 +58,8 @@ no-logging = [] [dependencies] bytes = "0.4" fallible-iterator = "0.1.3" -log = "0.3" -socket2 = "0.2" +log = "0.4" +socket2 = "0.3" openssl = { version = "0.9.2", optional = true } native-tls = { version = "0.1", optional = true } diff --git a/postgres/src/transaction.rs b/postgres/src/transaction.rs index 56e467aa..e1c8ab17 100644 --- a/postgres/src/transaction.rs +++ b/postgres/src/transaction.rs @@ -2,9 +2,10 @@ use std::cell::Cell; use std::fmt; +#[allow(unused_imports)] use std::ascii::AsciiExt; -use {bad_response, Result, Connection}; +use {bad_response, Connection, Result}; use rows::Rows; use stmt::Statement; use types::ToSql;