Skip to content

Commit 5dad5af

Browse files
authored
Merge pull request diesel-rs#1465 from diesel-rs/sg-refactor-pg-bool
Refactor the `ToSql` implementation of `bool` on PG
2 parents b07c24b + da914e8 commit 5dad5af

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

diesel/src/pg/types/primitives.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ impl ToSql<types::Bool, Pg> for bool {
1818
&self,
1919
out: &mut ToSqlOutput<W, Pg>,
2020
) -> Result<IsNull, Box<Error + Send + Sync>> {
21-
let write_result = if *self {
22-
out.write_all(&[1])
23-
} else {
24-
out.write_all(&[0])
25-
};
26-
write_result
21+
out.write_all(&[*self as u8])
2722
.map(|_| IsNull::No)
2823
.map_err(|e| Box::new(e) as Box<Error + Send + Sync>)
2924
}

0 commit comments

Comments
 (0)