Skip to content

Commit da76ac0

Browse files
committed
cargo fmt
1 parent 76145be commit da76ac0

51 files changed

Lines changed: 108 additions & 128 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/binlog/decimal/test/mod.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,13 @@ impl decimal_t {
5656
c_string2decimal(string.as_ptr() as *const i8, &mut to, end)
5757
};
5858
to.len = slice_end(to.as_ref(), 0x80000000_u32 as i32).len() as i32;
59-
if result == 0 {
60-
Ok(to)
61-
} else {
62-
Err(result)
63-
}
59+
if result == 0 { Ok(to) } else { Err(result) }
6460
}
6561

6662
pub fn rust_decimal2bin(&self, to: &mut [u8]) -> Result<(), i32> {
6763
let result =
6864
unsafe { c_decimal2bin(self, to.as_mut_ptr(), self.intg + self.frac, self.frac) };
69-
if result == 0 {
70-
Ok(())
71-
} else {
72-
Err(result)
73-
}
65+
if result == 0 { Ok(()) } else { Err(result) }
7466
}
7567

7668
pub fn rust_bin2decimal(
@@ -82,11 +74,7 @@ impl decimal_t {
8274
let mut to = Self::new();
8375
let result = unsafe { c_bin2decimal(from.as_ptr(), &mut to, precision, scale, keep_prec) };
8476
to.len = slice_end(to.as_ref(), 0x80000000_u32 as i32).len() as i32;
85-
if result == 0 {
86-
Ok(to)
87-
} else {
88-
Err(result)
89-
}
77+
if result == 0 { Ok(to) } else { Err(result) }
9078
}
9179

9280
pub fn rust_decimal2string(&self, to: &mut [u8]) -> Result<usize, i32> {

src/binlog/events/anonymous_gtid_event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use std::io::{self};
1010

1111
use crate::{
1212
binlog::{
13-
consts::{BinlogVersion, EventType},
1413
BinlogCtx, BinlogEvent, BinlogStruct,
14+
consts::{BinlogVersion, EventType},
1515
},
1616
io::ParseBuf,
1717
proto::{MyDeserialize, MySerialize},

src/binlog/events/begin_load_query_event.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ use saturating::Saturating as S;
1616

1717
use crate::{
1818
binlog::{
19-
consts::{BinlogVersion, EventType},
2019
BinlogCtx, BinlogEvent, BinlogStruct,
20+
consts::{BinlogVersion, EventType},
2121
},
2222
io::ParseBuf,
23-
misc::raw::{bytes::EofBytes, int::LeU32, RawBytes, RawInt},
23+
misc::raw::{RawBytes, RawInt, bytes::EofBytes, int::LeU32},
2424
proto::{MyDeserialize, MySerialize},
2525
};
2626

src/binlog/events/delete_rows_event.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ use std::io::{self};
1212

1313
use crate::{
1414
binlog::{
15-
consts::{BinlogVersion, EventType, RowsEventFlags},
1615
BinlogCtx, BinlogEvent, BinlogStruct,
16+
consts::{BinlogVersion, EventType, RowsEventFlags},
1717
},
1818
io::ParseBuf,
1919
proto::{MyDeserialize, MySerialize},
2020
};
2121

22-
use super::{rows_event::RowsEventCtx, RowsEvent, RowsEventRows, TableMapEvent};
22+
use super::{RowsEvent, RowsEventRows, TableMapEvent, rows_event::RowsEventCtx};
2323

2424
/// Delete rows event.
2525
///

src/binlog/events/delete_rows_event_v1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ use std::io::{self};
1212

1313
use crate::{
1414
binlog::{
15-
consts::{BinlogVersion, EventType, RowsEventFlags},
1615
BinlogCtx, BinlogEvent, BinlogStruct,
16+
consts::{BinlogVersion, EventType, RowsEventFlags},
1717
},
1818
io::ParseBuf,
1919
proto::{MyDeserialize, MySerialize},
2020
};
2121

22-
use super::{rows_event::RowsEventCtx, RowsEvent, RowsEventRows, TableMapEvent};
22+
use super::{RowsEvent, RowsEventRows, TableMapEvent, rows_event::RowsEventCtx};
2323

2424
/// Delete rows event v1 (mariadb and mysql 5.1.15-5.6.x).
2525
#[derive(Debug, Clone, Eq, PartialEq, Hash)]

src/binlog/events/execute_load_query_event.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ use saturating::Saturating as S;
1212

1313
use crate::{
1414
binlog::{
15-
consts::{BinlogVersion, EventType, LoadDuplicateHandling},
1615
BinlogCtx, BinlogEvent, BinlogStruct,
16+
consts::{BinlogVersion, EventType, LoadDuplicateHandling},
1717
},
1818
io::ParseBuf,
1919
misc::raw::{
20+
Const, RawBytes, RawInt, Skip,
2021
bytes::{BareU8Bytes, EofBytes},
2122
int::*,
22-
Const, RawBytes, RawInt, Skip,
2323
},
2424
proto::{MyDeserialize, MySerialize},
2525
};
@@ -259,7 +259,7 @@ impl<'de> MyDeserialize<'de> for ExecuteLoadQueryEvent<'de> {
259259
type Ctx = BinlogCtx<'de>;
260260

261261
fn deserialize(_: Self::Ctx, buf: &mut ParseBuf<'de>) -> io::Result<Self> {
262-
let mut sbuf: ParseBuf<'_>= buf.parse(26)?;
262+
let mut sbuf: ParseBuf<'_> = buf.parse(26)?;
263263

264264
let thread_id = sbuf.parse_unchecked(())?;
265265
let execution_time = sbuf.parse_unchecked(())?;

src/binlog/events/format_description_event.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ use saturating::Saturating as S;
1212

1313
use crate::{
1414
binlog::{
15-
consts::{BinlogVersion, EventType},
1615
BinlogCtx, BinlogEvent, BinlogStruct,
16+
consts::{BinlogVersion, EventType},
1717
},
1818
io::ParseBuf,
1919
misc::raw::{
20+
Const, RawBytes, RawInt,
2021
bytes::{EofBytes, FixedLengthText},
2122
int::{ConstU8, LeU16, LeU32},
22-
Const, RawBytes, RawInt,
2323
},
2424
proto::{MyDeserialize, MySerialize},
2525
};
@@ -300,7 +300,7 @@ impl<'de> MyDeserialize<'de> for FormatDescriptionEvent<'de> {
300300
type Ctx = BinlogCtx<'de>;
301301

302302
fn deserialize(_ctx: Self::Ctx, buf: &mut ParseBuf<'de>) -> io::Result<Self> {
303-
let mut sbuf: ParseBuf<'_>= buf.parse(57)?;
303+
let mut sbuf: ParseBuf<'_> = buf.parse(57)?;
304304
let binlog_version = sbuf.parse_unchecked(())?;
305305
let server_version = sbuf.parse_unchecked(())?;
306306
let create_timestamp = sbuf.parse_unchecked(())?;

src/binlog/events/gtid_event.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ use saturating::Saturating as S;
1212

1313
use crate::{
1414
binlog::{
15-
consts::{BinlogVersion, EventType, Gno, GtidFlags},
1615
BinlogCtx, BinlogEvent, BinlogStruct,
16+
consts::{BinlogVersion, EventType, Gno, GtidFlags},
1717
},
1818
io::ParseBuf,
19-
misc::raw::{int::*, RawConst, RawFlags},
19+
misc::raw::{RawConst, RawFlags, int::*},
2020
proto::{MyDeserialize, MySerialize},
2121
};
2222

@@ -251,7 +251,7 @@ impl<'de> MyDeserialize<'de> for GtidEvent {
251251
type Ctx = BinlogCtx<'de>;
252252

253253
fn deserialize(_ctx: Self::Ctx, buf: &mut ParseBuf<'de>) -> io::Result<Self> {
254-
let mut sbuf: ParseBuf<'_>= buf.parse(1 + Self::ENCODED_SID_LENGTH + 8)?;
254+
let mut sbuf: ParseBuf<'_> = buf.parse(1 + Self::ENCODED_SID_LENGTH + 8)?;
255255
let flags = sbuf.parse_unchecked(())?;
256256
let sid: [u8; Self::ENCODED_SID_LENGTH] = sbuf.parse_unchecked(())?;
257257
let gno = sbuf.parse_unchecked(())?;
@@ -270,7 +270,7 @@ impl<'de> MyDeserialize<'de> for GtidEvent {
270270
if !buf.is_empty() && buf.0[0] == Self::LOGICAL_TIMESTAMP_TYPECODE {
271271
lc_typecode = Some(buf.parse_unchecked(())?);
272272

273-
let mut sbuf: ParseBuf<'_>= buf.parse(16)?;
273+
let mut sbuf: ParseBuf<'_> = buf.parse(16)?;
274274
last_committed = sbuf.parse_unchecked(())?;
275275
sequence_number = sbuf.parse_unchecked(())?;
276276

src/binlog/events/incident_event.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ use saturating::Saturating as S;
1616

1717
use crate::{
1818
binlog::{
19-
consts::{BinlogVersion, EventType, IncidentType, UnknownIncidentType},
2019
BinlogCtx, BinlogEvent, BinlogStruct,
20+
consts::{BinlogVersion, EventType, IncidentType, UnknownIncidentType},
2121
},
2222
io::ParseBuf,
23-
misc::raw::{bytes::U8Bytes, int::*, RawBytes, RawConst},
23+
misc::raw::{RawBytes, RawConst, bytes::U8Bytes, int::*},
2424
proto::{MyDeserialize, MySerialize},
2525
};
2626

src/binlog/events/intvar_event.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ use std::io;
1010

1111
use crate::{
1212
binlog::{
13-
consts::{BinlogVersion, EventType, IntvarEventType},
1413
BinlogCtx, BinlogEvent, BinlogStruct,
14+
consts::{BinlogVersion, EventType, IntvarEventType},
1515
},
1616
io::ParseBuf,
17-
misc::raw::{int::*, Const},
17+
misc::raw::{Const, int::*},
1818
proto::{MyDeserialize, MySerialize},
1919
};
2020

0 commit comments

Comments
 (0)