Skip to content

Commit 53f5610

Browse files
committed
clippy: use built-in conversion from bool to numeric
This is really just a stylistic thing, but it makes the code shorter so I think we should use it.
1 parent 5130441 commit 53f5610

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ cast_possible_wrap = "allow"
5454
cast_sign_loss = "allow"
5555
# Exhaustive list of pedantic clippy lints
5656
assigning_clones = "warn"
57-
bool_to_int_with_if = "allow"
57+
bool_to_int_with_if = "warn"
5858
borrow_as_ptr = "warn"
5959
case_sensitive_file_extension_comparisons = "warn"
6060
cast_lossless = "allow"

src/value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl UIntValue {
155155
let mut byte = 0u8;
156156
for _ in 0..8 {
157157
let bit = padded_bits.next().unwrap();
158-
byte = (byte << 1) | if bit == '1' { 1 } else { 0 };
158+
byte = (byte << 1) | u8::from(bit == '1');
159159
}
160160
bytes.push(byte);
161161
}

0 commit comments

Comments
 (0)