Skip to content

Commit 3856e93

Browse files
authored
Merge pull request #1423 from dralley/fix-complaints
Fix some clippy complaints
2 parents d6d305f + a964f21 commit 3856e93

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

vm/src/obj/objbytes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,8 @@ impl PyBytesRef {
509509
}
510510
}
511511
None => {
512-
if replacing_char.is_some() {
513-
decode_content.push(replacing_char.unwrap())
512+
if let Some(replacing_char) = replacing_char {
513+
decode_content.push(replacing_char)
514514
}
515515
}
516516
}

vm/src/stdlib/binascii.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ fn binascii_unhexlify(hexstr: PyBytesRef, vm: &VirtualMachine) -> PyResult {
4545
for i in (0..hex_bytes.len()).step_by(2) {
4646
let n1 = unhex_nibble(hex_bytes[i]);
4747
let n2 = unhex_nibble(hex_bytes[i + 1]);
48-
if n1.is_some() && n2.is_some() {
49-
unhex.push(n1.unwrap() << 4 | n2.unwrap());
48+
if let (Some(n1), Some(n2)) = (n1, n2) {
49+
unhex.push(n1 << 4 | n2);
5050
} else {
5151
return Err(vm.new_value_error("Non-hexadecimal digit found".to_string()));
5252
}

vm/src/stdlib/hashlib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ struct HashWrapper {
204204
impl HashWrapper {
205205
fn new<D: 'static>(d: D) -> Self
206206
where
207-
D: DynDigest,
208-
D: Sized,
207+
D: DynDigest + Sized,
209208
{
210209
HashWrapper { inner: Box::new(d) }
211210
}

vm/src/stdlib/pystruct.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ fn parse_format_string(fmt: String) -> Result<FormatSpec, String> {
5656
/// See also: https://docs.python.org/3/library/struct.html?highlight=struct#byte-order-size-and-alignment
5757
fn parse_endiannes<I>(chars: &mut Peekable<I>) -> Endianness
5858
where
59-
I: Sized,
60-
I: Iterator<Item = char>,
59+
I: Sized + Iterator<Item = char>,
6160
{
6261
match chars.peek() {
6362
Some('@') => {
@@ -86,8 +85,7 @@ where
8685

8786
fn parse_format_codes<I>(chars: &mut Peekable<I>) -> Result<Vec<FormatCode>, String>
8887
where
89-
I: Sized,
90-
I: Iterator<Item = char>,
88+
I: Sized + Iterator<Item = char>,
9189
{
9290
let mut codes = vec![];
9391
for c in chars {

0 commit comments

Comments
 (0)