Skip to content
This repository was archived by the owner on Aug 9, 2021. It is now read-only.

Commit 52dd0b6

Browse files
committed
rustfmt
1 parent a0ba0ce commit 52dd0b6

File tree

22 files changed

+306
-273
lines changed

22 files changed

+306
-273
lines changed

postgres-protocol/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//!
1010
//! This library assumes that the `client_encoding` backend parameter has been
1111
//! set to `UTF8`. It will most likely not behave properly if that is not the case.
12-
#![doc(html_root_url="https://docs.rs/postgres-protocol/0.3")]
12+
#![doc(html_root_url = "https://docs.rs/postgres-protocol/0.3")]
1313
#![warn(missing_docs)]
1414
extern crate base64;
1515
extern crate byteorder;
@@ -68,13 +68,16 @@ macro_rules! from_usize {
6868
#[inline]
6969
fn from_usize(x: usize) -> io::Result<$t> {
7070
if x > <$t>::max_value() as usize {
71-
Err(io::Error::new(io::ErrorKind::InvalidInput, "value too large to transmit"))
71+
Err(io::Error::new(
72+
io::ErrorKind::InvalidInput,
73+
"value too large to transmit",
74+
))
7275
} else {
7376
Ok(x as $t)
7477
}
7578
}
7679
}
77-
}
80+
};
7881
}
7982

8083
from_usize!(i16);

postgres-protocol/src/message/frontend.rs

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//! Frontend message serialization.
22
#![allow(missing_docs)]
33

4-
use byteorder::{WriteBytesExt, BigEndian, ByteOrder};
4+
use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
55
use std::error::Error;
66
use std::io;
77
use std::marker;
88

9-
use {Oid, FromUsize, IsNull, write_nullable};
9+
use {write_nullable, FromUsize, IsNull, Oid};
1010

1111
pub enum Message<'a> {
1212
Bind {
@@ -16,24 +16,51 @@ pub enum Message<'a> {
1616
values: &'a [Option<Vec<u8>>],
1717
result_formats: &'a [i16],
1818
},
19-
CancelRequest { process_id: i32, secret_key: i32 },
20-
Close { variant: u8, name: &'a str },
21-
CopyData { data: &'a [u8] },
19+
CancelRequest {
20+
process_id: i32,
21+
secret_key: i32,
22+
},
23+
Close {
24+
variant: u8,
25+
name: &'a str,
26+
},
27+
CopyData {
28+
data: &'a [u8],
29+
},
2230
CopyDone,
23-
CopyFail { message: &'a str },
24-
Describe { variant: u8, name: &'a str },
25-
Execute { portal: &'a str, max_rows: i32 },
31+
CopyFail {
32+
message: &'a str,
33+
},
34+
Describe {
35+
variant: u8,
36+
name: &'a str,
37+
},
38+
Execute {
39+
portal: &'a str,
40+
max_rows: i32,
41+
},
2642
Parse {
2743
name: &'a str,
2844
query: &'a str,
2945
param_types: &'a [Oid],
3046
},
31-
PasswordMessage { password: &'a str },
32-
Query { query: &'a str },
33-
SaslInitialResponse { mechanism: &'a str, data: &'a [u8] },
34-
SaslResponse { data: &'a [u8] },
47+
PasswordMessage {
48+
password: &'a str,
49+
},
50+
Query {
51+
query: &'a str,
52+
},
53+
SaslInitialResponse {
54+
mechanism: &'a str,
55+
data: &'a [u8],
56+
},
57+
SaslResponse {
58+
data: &'a [u8],
59+
},
3560
SslRequest,
36-
StartupMessage { parameters: &'a [(String, String)] },
61+
StartupMessage {
62+
parameters: &'a [(String, String)],
63+
},
3764
Sync,
3865
Terminate,
3966
#[doc(hidden)]

postgres-shared/src/error/sqlstate.rs

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ impl SqlState {
3333
pub const WARNING_IMPLICIT_ZERO_BIT_PADDING: SqlState = SqlState(Cow::Borrowed("01008"));
3434

3535
/// 01003
36-
pub const WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION: SqlState = SqlState(Cow::Borrowed("01003"));
36+
pub const WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION: SqlState =
37+
SqlState(Cow::Borrowed("01003"));
3738

3839
/// 01007
3940
pub const WARNING_PRIVILEGE_NOT_GRANTED: SqlState = SqlState(Cow::Borrowed("01007"));
@@ -51,7 +52,8 @@ impl SqlState {
5152
pub const NO_DATA: SqlState = SqlState(Cow::Borrowed("02000"));
5253

5354
/// 02001
54-
pub const NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED: SqlState = SqlState(Cow::Borrowed("02001"));
55+
pub const NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED: SqlState =
56+
SqlState(Cow::Borrowed("02001"));
5557

5658
/// 03000
5759
pub const SQL_STATEMENT_NOT_YET_COMPLETE: SqlState = SqlState(Cow::Borrowed("03000"));
@@ -66,10 +68,12 @@ impl SqlState {
6668
pub const CONNECTION_FAILURE: SqlState = SqlState(Cow::Borrowed("08006"));
6769

6870
/// 08001
69-
pub const SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION: SqlState = SqlState(Cow::Borrowed("08001"));
71+
pub const SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION: SqlState =
72+
SqlState(Cow::Borrowed("08001"));
7073

7174
/// 08004
72-
pub const SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION: SqlState = SqlState(Cow::Borrowed("08004"));
75+
pub const SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION: SqlState =
76+
SqlState(Cow::Borrowed("08004"));
7377

7478
/// 08007
7579
pub const TRANSACTION_RESOLUTION_UNKNOWN: SqlState = SqlState(Cow::Borrowed("08007"));
@@ -105,7 +109,8 @@ impl SqlState {
105109
pub const DIAGNOSTICS_EXCEPTION: SqlState = SqlState(Cow::Borrowed("0Z000"));
106110

107111
/// 0Z002
108-
pub const STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER: SqlState = SqlState(Cow::Borrowed("0Z002"));
112+
pub const STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER: SqlState =
113+
SqlState(Cow::Borrowed("0Z002"));
109114

110115
/// 20000
111116
pub const CASE_NOT_FOUND: SqlState = SqlState(Cow::Borrowed("20000"));
@@ -159,7 +164,8 @@ impl SqlState {
159164
pub const INVALID_ARGUMENT_FOR_POWER_FUNCTION: SqlState = SqlState(Cow::Borrowed("2201F"));
160165

161166
/// 2201G
162-
pub const INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION: SqlState = SqlState(Cow::Borrowed("2201G"));
167+
pub const INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION: SqlState =
168+
SqlState(Cow::Borrowed("2201G"));
163169

164170
/// 22018
165171
pub const INVALID_CHARACTER_VALUE_FOR_CAST: SqlState = SqlState(Cow::Borrowed("22018"));
@@ -192,7 +198,8 @@ impl SqlState {
192198
pub const INVALID_ROW_COUNT_IN_LIMIT_CLAUSE: SqlState = SqlState(Cow::Borrowed("2201W"));
193199

194200
/// 2201X
195-
pub const INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE: SqlState = SqlState(Cow::Borrowed("2201X"));
201+
pub const INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE: SqlState =
202+
SqlState(Cow::Borrowed("2201X"));
196203

197204
/// 2202H
198205
pub const INVALID_TABLESAMPLE_ARGUMENT: SqlState = SqlState(Cow::Borrowed("2202H"));
@@ -303,22 +310,27 @@ impl SqlState {
303310
pub const BRANCH_TRANSACTION_ALREADY_ACTIVE: SqlState = SqlState(Cow::Borrowed("25002"));
304311

305312
/// 25008
306-
pub const HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL: SqlState = SqlState(Cow::Borrowed("25008"));
313+
pub const HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL: SqlState =
314+
SqlState(Cow::Borrowed("25008"));
307315

308316
/// 25003
309-
pub const INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25003"));
317+
pub const INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION: SqlState =
318+
SqlState(Cow::Borrowed("25003"));
310319

311320
/// 25004
312-
pub const INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25004"));
321+
pub const INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION: SqlState =
322+
SqlState(Cow::Borrowed("25004"));
313323

314324
/// 25005
315-
pub const NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25005"));
325+
pub const NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION: SqlState =
326+
SqlState(Cow::Borrowed("25005"));
316327

317328
/// 25006
318329
pub const READ_ONLY_SQL_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25006"));
319330

320331
/// 25007
321-
pub const SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED: SqlState = SqlState(Cow::Borrowed("25007"));
332+
pub const SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED: SqlState =
333+
SqlState(Cow::Borrowed("25007"));
322334

323335
/// 25P01
324336
pub const NO_ACTIVE_SQL_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25P01"));
@@ -345,7 +357,8 @@ impl SqlState {
345357
pub const INVALID_PASSWORD: SqlState = SqlState(Cow::Borrowed("28P01"));
346358

347359
/// 2B000
348-
pub const DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST: SqlState = SqlState(Cow::Borrowed("2B000"));
360+
pub const DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST: SqlState =
361+
SqlState(Cow::Borrowed("2B000"));
349362

350363
/// 2BP01
351364
pub const DEPENDENT_OBJECTS_STILL_EXIST: SqlState = SqlState(Cow::Borrowed("2BP01"));
@@ -357,7 +370,8 @@ impl SqlState {
357370
pub const SQL_ROUTINE_EXCEPTION: SqlState = SqlState(Cow::Borrowed("2F000"));
358371

359372
/// 2F005
360-
pub const S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT: SqlState = SqlState(Cow::Borrowed("2F005"));
373+
pub const S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT: SqlState =
374+
SqlState(Cow::Borrowed("2F005"));
361375

362376
/// 2F002
363377
pub const S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED: SqlState = SqlState(Cow::Borrowed("2F002"));
@@ -699,7 +713,8 @@ impl SqlState {
699713
pub const FDW_INVALID_OPTION_NAME: SqlState = SqlState(Cow::Borrowed("HV00D"));
700714

701715
/// HV090
702-
pub const FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH: SqlState = SqlState(Cow::Borrowed("HV090"));
716+
pub const FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH: SqlState =
717+
SqlState(Cow::Borrowed("HV090"));
703718

704719
/// HV00A
705720
pub const FDW_INVALID_STRING_FORMAT: SqlState = SqlState(Cow::Borrowed("HV00A"));

postgres-shared/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#![allow(unknown_lints)] // for clippy
22

3-
extern crate hex;
43
extern crate fallible_iterator;
4+
extern crate hex;
55
extern crate phf;
66
extern crate postgres_protocol;
77

88
pub mod error;
99
pub mod params;
10-
pub mod types;
1110
pub mod rows;
1211
pub mod stmt;
12+
pub mod types;
1313

1414
/// Contains information necessary to cancel queries for a session.
1515
#[derive(Copy, Clone, Debug)]

0 commit comments

Comments
 (0)