Skip to content

Commit 5ba3272

Browse files
authored
Fix clippy warnings (alfg#88)
* chore: fix clippy warnings * Update readme with clippy usage. * fix fmt warnings.
1 parent 8152e69 commit 5ba3272

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,22 @@ With print statement output.
103103
cargo test -- --nocapture
104104
```
105105

106+
#### Run Cargo fmt
107+
Run fmt to catch formatting errors.
108+
109+
```
110+
rustup component add rustfmt
111+
cargo fmt --all -- --check
112+
```
113+
114+
#### Run Clippy
115+
Run Clippy tests to catch common lints and mistakes.
116+
117+
```
118+
rustup component add clippy
119+
cargo clippy --no-deps -- -D warnings
120+
```
121+
106122
#### Run Benchmark Tests
107123
```
108124
cargo bench

src/mp4box/emsg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl EmsgBox {
2626
4 + // id
2727
Self::time_size(version) +
2828
(scheme_id_uri.len() + 1) as u64 +
29-
(value.len() as u64 + 1) as u64
29+
(value.len() as u64 + 1)
3030
}
3131

3232
fn time_size(version: u8) -> u64 {

src/mp4box/meta.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ impl<R: Read + Seek> ReadBox<&mut R> for MetaBox {
1717

1818
let (version, _) = read_box_header_ext(reader)?;
1919
if version != 0 {
20-
return Err(Error::UnsupportedBoxVersion(
21-
BoxType::UdtaBox,
22-
version as u8,
23-
));
20+
return Err(Error::UnsupportedBoxVersion(BoxType::UdtaBox, version));
2421
}
2522

2623
let mut ilst = None;

src/track.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ impl Mp4Track {
427427
fn sample_offset(&self, sample_id: u32) -> Result<u64> {
428428
if !self.trafs.is_empty() {
429429
if let Some((traf_idx, _sample_idx)) = self.find_traf_idx_and_sample_idx(sample_id) {
430-
Ok(self.trafs[traf_idx].tfhd.base_data_offset as u64)
430+
Ok(self.trafs[traf_idx].tfhd.base_data_offset)
431431
} else {
432432
Err(Error::BoxInTrafNotFound(self.track_id(), BoxType::TrafBox))
433433
}

0 commit comments

Comments
 (0)