Skip to content

Commit 9263d82

Browse files
authored
Miscellaneous code modernizations (shssoichiro#97)
* Remove `extern crate bitflags` * Use `use` to rename dependency in examples * Remove more useless `extern crate` * delete empty file * remove macro_use where possible removing macro_export would be good too, but is breaking * run cargo fmt after changes * fix new clippy lint * Make API exports more readable * Enable too_many_arguments lint add exception for old API * Add TODO for safety docs
1 parent 9054e5b commit 9263d82

File tree

32 files changed

+62
-83
lines changed

32 files changed

+62
-83
lines changed

examples/chapters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extern crate ffmpeg_the_third as ffmpeg;
1+
use ffmpeg_the_third as ffmpeg;
22

33
use std::env;
44

examples/codec-info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extern crate ffmpeg_the_third as ffmpeg;
1+
use ffmpeg_the_third as ffmpeg;
22

33
use std::env;
44

examples/dump-frames.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extern crate ffmpeg_the_third as ffmpeg;
1+
use ffmpeg_the_third as ffmpeg;
22

33
use crate::ffmpeg::format::{input, Pixel};
44
use crate::ffmpeg::media::Type;

examples/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extern crate ffmpeg_the_third as ffmpeg;
1+
use ffmpeg_the_third as ffmpeg;
22

33
use std::env;
44

examples/remux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extern crate ffmpeg_the_third as ffmpeg;
1+
use ffmpeg_the_third as ffmpeg;
22

33
use std::env;
44

examples/transcode-audio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extern crate ffmpeg_the_third as ffmpeg;
1+
use ffmpeg_the_third as ffmpeg;
22

33
use std::env;
44
use std::path::Path;

examples/transcode-x264.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// transcode-x264 input.flv output.mp4
1616
// transcode-x264 input.mkv output.mkv 'preset=veryslow,crf=18'
1717

18-
extern crate ffmpeg_the_third as ffmpeg;
18+
use ffmpeg_the_third as ffmpeg;
1919

2020
use std::collections::HashMap;
2121
use std::env;

ffmpeg-sys-the-third/build.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
extern crate bindgen;
2-
extern crate cc;
3-
extern crate clang;
4-
extern crate pkg_config;
5-
61
use std::collections::HashMap;
72
use std::env;
83
use std::fmt::Write as FmtWrite;
@@ -634,7 +629,7 @@ fn rustc_link_extralibs(source_dir: &Path) {
634629
.map(|line| line.unwrap())
635630
.unwrap();
636631

637-
let linker_args = extra_libs.split('=').last().unwrap().split(' ');
632+
let linker_args = extra_libs.split('=').next_back().unwrap().split(' ');
638633
let include_libs = linker_args
639634
.filter(|v| v.starts_with("-l"))
640635
.map(|flag| &flag[2..]);

ffmpeg-sys-the-third/src/avutil/pixfmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use libc::c_int;
22

3-
use crate::{AVChromaLocation, AVPixelFormat};
43
use crate::AVPixelFormat::*;
4+
use crate::{AVChromaLocation, AVPixelFormat};
55

66
impl AVChromaLocation {
77
pub fn from_c_int(n: c_int) -> Option<Self> {

ffmpeg-sys-the-third/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#![allow(clippy::too_many_arguments)]
88
#![allow(clippy::type_complexity)]
99

10-
extern crate libc;
11-
1210
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
1311

1412
mod avutil;

0 commit comments

Comments
 (0)