Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy warnings #88

Merged
merged 3 commits into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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