Skip to content

Commit

Permalink
Run cargo clippy -fix
Browse files Browse the repository at this point in the history
  • Loading branch information
data-retriever committed May 31, 2022
1 parent fbe60de commit f7f6d12
Show file tree
Hide file tree
Showing 44 changed files with 142 additions and 144 deletions.
6 changes: 3 additions & 3 deletions benches/bench_main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use criterion::BenchmarkId;
use criterion::{criterion_group, criterion_main, Criterion};
use mp4;

use std::fs::File;

fn read_mp4(filename: &str) -> u64 {
let f = File::open(filename).unwrap();
let m = mp4::read_mp4(f).unwrap();
let size = m.size();
size

m.size()
}

fn criterion_benchmark(c: &mut Criterion) {
Expand Down
2 changes: 1 addition & 1 deletion examples/mp4copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn copy<P: AsRef<Path>>(src_filename: &P, dst_filename: &P) -> Result<()> {
let mut mp4_writer = mp4::Mp4Writer::write_start(
writer,
&Mp4Config {
major_brand: mp4_reader.major_brand().clone(),
major_brand: *mp4_reader.major_brand(),
minor_version: mp4_reader.minor_version(),
compatible_brands: mp4_reader.compatible_brands().to_vec(),
timescale: mp4_reader.timescale(),
Expand Down
6 changes: 3 additions & 3 deletions examples/mp4dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ fn get_boxes(file: File) -> Result<Vec<Box>> {
Ok(boxes)
}

fn build_box<M: Mp4Box + std::fmt::Debug>(ref m: &M) -> Box {
return Box {
fn build_box<M: Mp4Box + std::fmt::Debug>(m: &M) -> Box {
Box {
name: m.box_type().to_string(),
size: m.box_size(),
summary: m.summary().unwrap(),
indent: 0,
};
}
}
2 changes: 1 addition & 1 deletion examples/mp4info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn info<P: AsRef<Path>>(filename: &P) -> Result<()> {
let mut compatible_brands = String::new();
for brand in mp4.compatible_brands().iter() {
compatible_brands.push_str(&brand.to_string());
compatible_brands.push_str(" ");
compatible_brands.push(' ');
}
println!(" compatible_brands: {}\n", compatible_brands);

Expand Down
2 changes: 1 addition & 1 deletion examples/simple.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use mp4;

use std::env;
use std::fs::File;

Expand Down
4 changes: 2 additions & 2 deletions src/mp4box/avc1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ impl Avc1Box {

impl Mp4Box for Avc1Box {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand Down
4 changes: 2 additions & 2 deletions src/mp4box/co64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ impl Co64Box {

impl Mp4Box for Co64Box {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand Down
4 changes: 2 additions & 2 deletions src/mp4box/ctts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ pub struct CttsEntry {

impl Mp4Box for CttsBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand Down
16 changes: 8 additions & 8 deletions src/mp4box/dinf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ impl DinfBox {

impl Mp4Box for DinfBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
}

fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}
Expand Down Expand Up @@ -119,19 +119,19 @@ impl DrefBox {

impl Mp4Box for DrefBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
}

fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}
Expand Down Expand Up @@ -231,11 +231,11 @@ impl UrlBox {

impl Mp4Box for UrlBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand Down
6 changes: 3 additions & 3 deletions src/mp4box/edts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ impl EdtsBox {

impl Mp4Box for EdtsBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
}

fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/mp4box/elst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ impl ElstBox {

impl Mp4Box for ElstBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand Down
4 changes: 2 additions & 2 deletions src/mp4box/ftyp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ impl FtypBox {

impl Mp4Box for FtypBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand Down
6 changes: 3 additions & 3 deletions src/mp4box/hdlr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ impl HdlrBox {

impl Mp4Box for HdlrBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand All @@ -38,7 +38,7 @@ impl Mp4Box for HdlrBox {
fn summary(&self) -> Result<String> {
let s = format!(
"handler_type={} name={}",
self.handler_type.to_string(),
self.handler_type,
self.name
);
Ok(s)
Expand Down
8 changes: 4 additions & 4 deletions src/mp4box/hev1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ impl Hev1Box {

impl Mp4Box for Hev1Box {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand Down Expand Up @@ -172,8 +172,8 @@ impl Mp4Box for HvcCBox {
}

fn box_size(&self) -> u64 {
let size = HEADER_SIZE + 1;
size

HEADER_SIZE + 1
}

fn to_json(&self) -> Result<String> {
Expand Down
6 changes: 3 additions & 3 deletions src/mp4box/mdhd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ impl Default for MdhdBox {

impl Mp4Box for MdhdBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand Down Expand Up @@ -151,7 +151,7 @@ fn language_string(language: u16) -> String {
.map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))
.collect::<String>();

return lang_str;
lang_str
}

fn language_code(language: &str) -> u16 {
Expand Down
6 changes: 3 additions & 3 deletions src/mp4box/mdia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ impl MdiaBox {

impl Mp4Box for MdiaBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
}

fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/mp4box/mehd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ impl Default for MehdBox {

impl Mp4Box for MehdBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand Down
4 changes: 2 additions & 2 deletions src/mp4box/mfhd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ impl MfhdBox {

impl Mp4Box for MfhdBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand Down
6 changes: 3 additions & 3 deletions src/mp4box/minf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ impl MinfBox {

impl Mp4Box for MinfBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Ok(serde_json::to_string(&self).unwrap())
}

fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/mp4box/moof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ impl MoofBox {

impl Mp4Box for MoofBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand Down
4 changes: 2 additions & 2 deletions src/mp4box/moov.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ impl MoovBox {

impl Mp4Box for MoovBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}

fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}

fn to_json(&self) -> Result<String> {
Expand Down
Loading

0 comments on commit f7f6d12

Please sign in to comment.