Skip to content

Commit 6a64b60

Browse files
committed
Bump rustfmt
1 parent e2de364 commit 6a64b60

33 files changed

Lines changed: 127 additions & 252 deletions

File tree

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ matrix:
5555
- (cd diesel_migrations && cargo rustc --no-default-features --features "lint dotenv sqlite postgres mysql" -- -Zno-trans)
5656
- (cd diesel_infer_schema && cargo rustc --no-default-features --features "lint dotenv sqlite postgres mysql" -- -Zno-trans)
5757
- (cd diesel_compile_tests && travis-cargo test)
58-
- rust: nightly-2017-11-29
58+
- rust: nightly-2017-12-12
5959
env: RUSTFMT=YESPLEASE
6060
script:
6161
- |
6262
if ! [ -x "$(command -v rustfmt)" ]; then
63-
cargo install rustfmt-nightly --vers 0.2.16
63+
cargo install rustfmt-nightly --vers 0.3.1
6464
fi
6565
- cargo fmt --all -- --write-mode=diff
6666
env:

diesel/src/macros/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,6 @@ macro_rules! joinable_inner {
10361036
}
10371037
}
10381038

1039-
10401039
/// Allow two or more tables which are otherwise unrelated to be used together
10411040
/// in a query.
10421041
///

diesel/src/mysql/connection/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,8 @@ impl MysqlConnection {
116116
where
117117
T: QueryFragment<Mysql> + QueryId,
118118
{
119-
let mut stmt = self.statement_cache.cached_statement(
120-
source,
121-
&[],
122-
|sql| self.raw_connection.prepare(sql),
123-
)?;
119+
let mut stmt = self.statement_cache
120+
.cached_statement(source, &[], |sql| self.raw_connection.prepare(sql))?;
124121
let mut bind_collector = RawBytesBindCollector::<Mysql>::new();
125122
try!(source.collect_binds(&mut bind_collector, &()));
126123
let metadata = bind_collector.metadata;

diesel/src/mysql/connection/raw.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ fn perform_thread_unsafe_library_initialization() {
204204
MYSQL_THREAD_UNSAFE_INIT.call_once(|| {
205205
// mysql_library_init is defined by `#define mysql_library_init mysql_server_init`
206206
// which isn't picked up by bindgen
207-
let error_code = unsafe { ffi::mysql_server_init(0, ptr::null_mut(), ptr::null_mut()) };
207+
let error_code =
208+
unsafe { ffi::mysql_server_init(0, ptr::null_mut(), ptr::null_mut()) };
208209
if error_code != 0 {
209210
// FIXME: This is documented as Nonzero if an error occurred.
210211
// Presumably the value has some sort of meaning that we should

diesel/src/mysql/connection/stmt/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ impl Statement {
8282
NamedStatementIterator::new(self)
8383
}
8484

85-
8685
fn last_error_message(&self) -> String {
8786
unsafe { CStr::from_ptr(ffi::mysql_stmt_error(self.stmt)) }
8887
.to_string_lossy()

diesel/src/mysql/connection/url.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn decode_into_cstring(s: &str) -> ConnectionResult<CString> {
7777
let decoded = try!(
7878
percent_decode(s.as_bytes())
7979
.decode_utf8()
80-
.map_err(|_| { connection_url_error() })
80+
.map_err(|_| connection_url_error())
8181
);
8282
CString::new(decoded.as_bytes()).map_err(Into::into)
8383
}
@@ -139,8 +139,7 @@ fn userinfo_should_be_percent_decode() {
139139

140140
let db_url = format!(
141141
"mysql://{}:{}@localhost/bar",
142-
encoded_username,
143-
encoded_password
142+
encoded_username, encoded_password
144143
);
145144
let db_url = Url::parse(&db_url).unwrap();
146145

diesel/src/mysql/types/date_and_time.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ impl FromSql<Timestamp, Mysql> for NaiveDateTime {
9898
mysql_time.second_part as u32,
9999
)
100100
})
101-
.ok_or_else(|| {
102-
format!("Cannot parse this date: {:?}", mysql_time).into()
103-
})
101+
.ok_or_else(|| format!("Cannot parse this date: {:?}", mysql_time).into())
104102
}
105103
}
106104

@@ -126,9 +124,7 @@ impl FromSql<Time, Mysql> for NaiveTime {
126124
mysql_time.hour as u32,
127125
mysql_time.minute as u32,
128126
mysql_time.second as u32,
129-
).ok_or_else(|| {
130-
format!("Unable to convert {:?} to chrono", mysql_time).into()
131-
})
127+
).ok_or_else(|| format!("Unable to convert {:?} to chrono", mysql_time).into())
132128
}
133129
}
134130

@@ -154,9 +150,7 @@ impl FromSql<Date, Mysql> for NaiveDate {
154150
mysql_time.year as i32,
155151
mysql_time.month as u32,
156152
mysql_time.day as u32,
157-
).ok_or_else(|| {
158-
format!("Unable to convert {:?} to chrono", mysql_time).into()
159-
})
153+
).ok_or_else(|| format!("Unable to convert {:?} to chrono", mysql_time).into())
160154
}
161155
}
162156

diesel/src/mysql/types/numeric.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ pub mod bigdecimal {
2525
impl FromSql<types::Numeric, Mysql> for BigDecimal {
2626
fn from_sql(bytes: Option<&[u8]>) -> Result<Self, Box<Error + Send + Sync>> {
2727
let bytes = not_none!(bytes);
28-
BigDecimal::parse_bytes(bytes, 10).ok_or_else(|| {
29-
Box::from(format!("{:?} is not valid decimal number ", bytes))
30-
})
28+
BigDecimal::parse_bytes(bytes, 10)
29+
.ok_or_else(|| Box::from(format!("{:?} is not valid decimal number ", bytes)))
3130
}
3231
}
3332

diesel/src/pg/connection/stmt/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ impl Statement {
3232
.collect::<Vec<_>>();
3333
let param_lengths = param_data
3434
.iter()
35-
.map(|data| {
36-
data.as_ref().map(|d| d.len() as libc::c_int).unwrap_or(0)
37-
})
35+
.map(|data| data.as_ref().map(|d| d.len() as libc::c_int).unwrap_or(0))
3836
.collect::<Vec<_>>();
3937
let internal_res = unsafe {
4038
conn.exec_prepared(

diesel/src/pg/types/date_and_time/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ impl FromSql<types::Interval, Pg> for PgInterval {
172172
Ok(PgInterval {
173173
microseconds: try!(FromSql::<types::BigInt, Pg>::from_sql(Some(&bytes[..8]))),
174174
days: try!(FromSql::<types::Integer, Pg>::from_sql(Some(&bytes[8..12]))),
175-
months: try!(FromSql::<types::Integer, Pg>::from_sql(
176-
Some(&bytes[12..16])
177-
)),
175+
months: try!(FromSql::<types::Integer, Pg>::from_sql(Some(
176+
&bytes[12..16]
177+
))),
178178
})
179179
}
180180
}

0 commit comments

Comments
 (0)