1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-05-08 03:22:59 +00:00

Fix clippy warnings (#88)

* chore: fix clippy warnings

* Update readme with clippy usage.

* fix fmt warnings.
This commit is contained in:
Alfred Gutierrez 2023-01-05 19:03:02 -08:00 committed by GitHub
parent c26bdcab59
commit 3095051512
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 6 deletions

View file

@ -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

View file

@ -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 {

View file

@ -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;

View file

@ -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))
}