Skip to content

Commit

Permalink
Fix clippy warnings (alfg#88)
Browse files Browse the repository at this point in the history
* chore: fix clippy warnings

* Update readme with clippy usage.

* fix fmt warnings.
  • Loading branch information
alfg authored Jan 6, 2023
1 parent 8152e69 commit 5ba3272
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,22 @@ With print statement output.
cargo test -- --nocapture
```

#### Run Cargo fmt
Run fmt to catch formatting errors.

```
rustup component add rustfmt
cargo fmt --all -- --check
```

#### Run Clippy
Run Clippy tests to catch common lints and mistakes.

```
rustup component add clippy
cargo clippy --no-deps -- -D warnings
```

#### Run Benchmark Tests
```
cargo bench
Expand Down
2 changes: 1 addition & 1 deletion src/mp4box/emsg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl EmsgBox {
4 + // id
Self::time_size(version) +
(scheme_id_uri.len() + 1) as u64 +
(value.len() as u64 + 1) as u64
(value.len() as u64 + 1)
}

fn time_size(version: u8) -> u64 {
Expand Down
5 changes: 1 addition & 4 deletions src/mp4box/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ impl<R: Read + Seek> ReadBox<&mut R> for MetaBox {

let (version, _) = read_box_header_ext(reader)?;
if version != 0 {
return Err(Error::UnsupportedBoxVersion(
BoxType::UdtaBox,
version as u8,
));
return Err(Error::UnsupportedBoxVersion(BoxType::UdtaBox, version));
}

let mut ilst = None;
Expand Down
2 changes: 1 addition & 1 deletion src/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ impl Mp4Track {
fn sample_offset(&self, sample_id: u32) -> Result<u64> {
if !self.trafs.is_empty() {
if let Some((traf_idx, _sample_idx)) = self.find_traf_idx_and_sample_idx(sample_id) {
Ok(self.trafs[traf_idx].tfhd.base_data_offset as u64)
Ok(self.trafs[traf_idx].tfhd.base_data_offset)
} else {
Err(Error::BoxInTrafNotFound(self.track_id(), BoxType::TrafBox))
}
Expand Down

0 comments on commit 5ba3272

Please sign in to comment.