We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
ToSql
bool
1 parent 179473a commit da914e8Copy full SHA for da914e8
1 file changed
diesel/src/pg/types/primitives.rs
@@ -18,12 +18,7 @@ impl ToSql<types::Bool, Pg> for bool {
18
&self,
19
out: &mut ToSqlOutput<W, Pg>,
20
) -> 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
+ out.write_all(&[*self as u8])
27
.map(|_| IsNull::No)
28
.map_err(|e| Box::new(e) as Box<Error + Send + Sync>)
29
}
0 commit comments