Skip to content

Commit 6ff59ac

Browse files
committed
rustfmt
1 parent b4ce9c3 commit 6ff59ac

File tree

8 files changed

+68
-32
lines changed

8 files changed

+68
-32
lines changed

codegen/src/sqlstate.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ impl SqlState {{
6060
&self.0
6161
}}
6262
"
63-
).unwrap();
63+
)
64+
.unwrap();
6465
}
6566

6667
fn make_consts(codes: &LinkedHashMap<String, Vec<String>>, file: &mut BufWriter<File>) {
@@ -74,7 +75,8 @@ fn make_consts(codes: &LinkedHashMap<String, Vec<String>>, file: &mut BufWriter<
7475
"#,
7576
name = name,
7677
code = code,
77-
).unwrap();
78+
)
79+
.unwrap();
7880
}
7981
}
8082

@@ -87,7 +89,8 @@ fn make_map(codes: &LinkedHashMap<String, Vec<String>>, file: &mut BufWriter<Fil
8789
"
8890
#[cfg_attr(rustfmt, rustfmt_skip)]
8991
static SQLSTATE_MAP: phf::Map<&'static str, SqlState> = "
90-
).unwrap();
92+
)
93+
.unwrap();
9194
let mut builder = phf_codegen::Map::new();
9295
for (code, names) in codes {
9396
builder.entry(&**code, &format!("SqlState::{}", &names[0]));

codegen/src/type_gen.rs

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ pub struct Other {{
132132
pub schema: String,
133133
}}
134134
"
135-
).unwrap();
135+
)
136+
.unwrap();
136137
}
137138

138139
fn make_enum(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
@@ -141,15 +142,17 @@ fn make_enum(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
141142
"
142143
#[derive(PartialEq, Eq, Clone, Debug)]
143144
pub enum Inner {{"
144-
).unwrap();
145+
)
146+
.unwrap();
145147

146148
for type_ in types.values() {
147149
write!(
148150
w,
149151
"
150152
{},",
151153
type_.variant
152-
).unwrap();
154+
)
155+
.unwrap();
153156
}
154157

155158
write!(
@@ -159,7 +162,8 @@ pub enum Inner {{"
159162
}}
160163
161164
"
162-
).unwrap();
165+
)
166+
.unwrap();
163167
}
164168

165169
fn make_impl(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
@@ -169,15 +173,17 @@ fn make_impl(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
169173
pub fn from_oid(oid: Oid) -> Option<Inner> {{
170174
match oid {{
171175
",
172-
).unwrap();
176+
)
177+
.unwrap();
173178

174179
for (oid, type_) in types {
175180
write!(
176181
w,
177182
" {} => Some(Inner::{}),
178183
",
179184
oid, type_.variant
180-
).unwrap();
185+
)
186+
.unwrap();
181187
}
182188

183189
write!(
@@ -189,15 +195,17 @@ fn make_impl(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
189195
pub fn oid(&self) -> Oid {{
190196
match *self {{
191197
",
192-
).unwrap();
198+
)
199+
.unwrap();
193200

194201
for (oid, type_) in types {
195202
write!(
196203
w,
197204
" Inner::{} => {},
198205
",
199206
type_.variant, oid
200-
).unwrap();
207+
)
208+
.unwrap();
201209
}
202210

203211
write!(
@@ -209,7 +217,8 @@ fn make_impl(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
209217
pub fn kind(&self) -> &Kind {{
210218
match *self {{
211219
",
212-
).unwrap();
220+
)
221+
.unwrap();
213222

214223
for type_ in types.values() {
215224
let kind = match type_.kind {
@@ -227,7 +236,8 @@ fn make_impl(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
227236
}}
228237
",
229238
type_.variant, kind
230-
).unwrap();
239+
)
240+
.unwrap();
231241
}
232242

233243
write!(
@@ -239,15 +249,17 @@ fn make_impl(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
239249
pub fn name(&self) -> &str {{
240250
match *self {{
241251
"#,
242-
).unwrap();
252+
)
253+
.unwrap();
243254

244255
for type_ in types.values() {
245256
write!(
246257
w,
247258
r#" Inner::{} => "{}",
248259
"#,
249260
type_.variant, type_.name
250-
).unwrap();
261+
)
262+
.unwrap();
251263
}
252264

253265
write!(
@@ -257,7 +269,8 @@ fn make_impl(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
257269
}}
258270
}}
259271
"
260-
).unwrap();
272+
)
273+
.unwrap();
261274
}
262275

263276
fn make_consts(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
@@ -272,7 +285,8 @@ fn make_consts(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
272285
docs = type_.doc,
273286
ident = type_.ident,
274287
variant = type_.variant
275-
).unwrap();
288+
)
289+
.unwrap();
276290
}
277291

278292
write!(w, "}}").unwrap();

postgres-protocol/src/types.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ pub fn float8_from_sql(mut buf: &[u8]) -> Result<f64, StdBox<dyn Error + Sync +
167167

168168
/// Serializes an `HSTORE` value.
169169
#[inline]
170-
pub fn hstore_to_sql<'a, I>(values: I, buf: &mut Vec<u8>) -> Result<(), StdBox<dyn Error + Sync + Send>>
170+
pub fn hstore_to_sql<'a, I>(
171+
values: I,
172+
buf: &mut Vec<u8>,
173+
) -> Result<(), StdBox<dyn Error + Sync + Send>>
171174
where
172175
I: IntoIterator<Item = (&'a str, Option<&'a str>)>,
173176
{
@@ -228,7 +231,9 @@ impl<'a> FallibleIterator for HstoreEntries<'a> {
228231
type Error = StdBox<dyn Error + Sync + Send>;
229232

230233
#[inline]
231-
fn next(&mut self) -> Result<Option<(&'a str, Option<&'a str>)>, StdBox<dyn Error + Sync + Send>> {
234+
fn next(
235+
&mut self,
236+
) -> Result<Option<(&'a str, Option<&'a str>)>, StdBox<dyn Error + Sync + Send>> {
232237
if self.remaining == 0 {
233238
if !self.buf.is_empty() {
234239
return Err("invalid buffer size".into());
@@ -288,7 +293,9 @@ where
288293

289294
/// Deserializes a `VARBIT` or `BIT` value.
290295
#[inline]
291-
pub fn varbit_from_sql<'a>(mut buf: &'a [u8]) -> Result<Varbit<'a>, StdBox<dyn Error + Sync + Send>> {
296+
pub fn varbit_from_sql<'a>(
297+
mut buf: &'a [u8],
298+
) -> Result<Varbit<'a>, StdBox<dyn Error + Sync + Send>> {
292299
let len = buf.read_i32::<BigEndian>()?;
293300
if len < 0 {
294301
return Err("invalid varbit length".into());
@@ -1053,7 +1060,8 @@ mod test {
10531060
None => Ok(IsNull::Yes),
10541061
},
10551062
&mut buf,
1056-
).unwrap();
1063+
)
1064+
.unwrap();
10571065

10581066
let array = array_from_sql(&buf).unwrap();
10591067
assert_eq!(array.has_nulls(), true);
@@ -1089,7 +1097,8 @@ mod test {
10891097
None => Ok(IsNull::Yes),
10901098
},
10911099
&mut buf,
1092-
).unwrap();
1100+
)
1101+
.unwrap();
10931102

10941103
let array = array_from_sql(&buf).unwrap();
10951104
assert_eq!(array.has_nulls(), false);

tokio-postgres-native-tls/src/test.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ fn require() {
3838
let connector = native_tls::TlsConnector::builder()
3939
.add_root_certificate(
4040
Certificate::from_pem(include_bytes!("../../test/server.crt")).unwrap(),
41-
).build()
41+
)
42+
.build()
4243
.unwrap();
4344
smoke_test(
4445
tokio_postgres::Builder::new()
@@ -53,7 +54,8 @@ fn prefer() {
5354
let connector = native_tls::TlsConnector::builder()
5455
.add_root_certificate(
5556
Certificate::from_pem(include_bytes!("../../test/server.crt")).unwrap(),
56-
).build()
57+
)
58+
.build()
5759
.unwrap();
5860
smoke_test(
5961
tokio_postgres::Builder::new()
@@ -68,7 +70,8 @@ fn scram_user() {
6870
let connector = native_tls::TlsConnector::builder()
6971
.add_root_certificate(
7072
Certificate::from_pem(include_bytes!("../../test/server.crt")).unwrap(),
71-
).build()
73+
)
74+
.build()
7275
.unwrap();
7376
smoke_test(
7477
tokio_postgres::Builder::new()

tokio-postgres/src/proto/client.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ impl Client {
161161
QueryStream::new(self.clone(), pending, portal.clone())
162162
}
163163

164-
pub fn copy_in<S>(&self, statement: &Statement, params: &[&dyn ToSql], stream: S) -> CopyInFuture<S>
164+
pub fn copy_in<S>(
165+
&self,
166+
statement: &Statement,
167+
params: &[&dyn ToSql],
168+
stream: S,
169+
) -> CopyInFuture<S>
165170
where
166171
S: Stream,
167172
S::Item: IntoBuf,
@@ -236,7 +241,11 @@ impl Client {
236241
}
237242
}
238243

239-
fn excecute_message(&self, statement: &Statement, params: &[&dyn ToSql]) -> Result<Vec<u8>, Error> {
244+
fn excecute_message(
245+
&self,
246+
statement: &Statement,
247+
params: &[&dyn ToSql],
248+
) -> Result<Vec<u8>, Error> {
240249
let mut buf = self.bind_message(statement, "", params)?;
241250
frontend::execute("", 0, &mut buf).map_err(Error::parse)?;
242251
frontend::sync(&mut buf);

tokio-postgres/src/types/chrono.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use chrono::{
2-
DateTime, Duration, FixedOffset, Local, NaiveDate, NaiveDateTime, NaiveTime, Utc,
3-
};
1+
use chrono::{DateTime, Duration, FixedOffset, Local, NaiveDate, NaiveDateTime, NaiveTime, Utc};
42
use postgres_protocol::types;
53
use std::error::Error;
64

tokio-postgres/src/types/geo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use geo::{Coordinate, LineString, Point, Rect};
21
use fallible_iterator::FallibleIterator;
2+
use geo::{Coordinate, LineString, Point, Rect};
33
use postgres_protocol::types;
44
use std::error::Error;
55

tokio-postgres/src/types/uuid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use uuid::Uuid;
21
use postgres_protocol::types;
32
use std::error::Error;
3+
use uuid::Uuid;
44

55
use types::{FromSql, IsNull, ToSql, Type};
66

0 commit comments

Comments
 (0)