Skip to content

Commit ce85eda

Browse files
fix: lint fixup
1 parent af14e3b commit ce85eda

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/encode_smv.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn sample_length(sample: &Sample) -> usize {
4949
/// Calculates the encoded length of all samples
5050
/// Returns the size in bytes of the sample data (without the 0x87 wrapper tag/length)
5151
fn samples_length(samples: &[Sample]) -> usize {
52-
samples.iter().map(|s| sample_length(s)).sum()
52+
samples.iter().map(sample_length).sum()
5353
}
5454

5555
/// Calculates the encoded length of a single ASDU
@@ -169,13 +169,13 @@ fn smv_size(header: &EthernetHeader, pdu: &SavPdu) -> usize {
169169
/// - 4 bytes for larger values (0x83 + 3 bytes)
170170
fn size_length(value: usize) -> usize {
171171
if value < 128 {
172-
return 1;
172+
1
173173
} else if value < 256 {
174-
return 2;
174+
2
175175
} else if value < 65535 {
176-
return 3;
176+
3
177177
} else {
178-
return 4;
178+
4
179179
}
180180
}
181181

@@ -413,7 +413,7 @@ fn encode_sample(buffer: &mut [u8], mut pos: usize, sample: &Sample) -> Result<u
413413
quality_data.extend_from_slice(&quality_bytes);
414414
pos = encode_ber(0x84, &quality_data, buffer, pos)?;
415415

416-
return Ok(pos);
416+
Ok(pos)
417417
}
418418

419419
/// Encodes all samples in the ASDU
@@ -428,7 +428,7 @@ fn encode_samples(
428428
pos = encode_sample(buffer, pos, sample)?;
429429
}
430430

431-
return Ok(pos);
431+
Ok(pos)
432432
}
433433

434434
/// Encodes a single SavAsdu
@@ -480,7 +480,7 @@ fn encode_sav_asdu(
480480
pos = encode_octet_string(0x89, gm_identity, buffer, pos)?;
481481
}
482482

483-
return Ok(pos);
483+
Ok(pos)
484484
}
485485

486486
/// Encodes the complete SMV PDU (without Ethernet header)
@@ -515,7 +515,7 @@ fn encode_sav_pdu(buffer: &mut [u8], mut pos: usize, pdu: &SavPdu) -> Result<usi
515515
pos = encode_sav_asdu(buffer, pos, asdu)?;
516516
}
517517

518-
return Ok(pos);
518+
Ok(pos)
519519
}
520520

521521
/// Encodes an Ethernet header for IEC 61850 protocols (GOOSE/SMV)
@@ -566,7 +566,7 @@ fn encode_ethernet_header(buffer: &mut [u8], header: &EthernetHeader, length: u1
566566
buffer[new_pos..new_pos + 2].copy_from_slice(&[0; 2]);
567567
new_pos += 2;
568568

569-
return new_pos;
569+
new_pos
570570
}
571571

572572
/// Encodes a complete SMV packet including Ethernet header with preallocated buffer

0 commit comments

Comments
 (0)