Skip to content

Commit 2aedb79

Browse files
committed
clippy: fix all remaining issues
Also disable a couple of lints that are mostly outside our control (i.e. in code generated by bindgen).
1 parent ab516bc commit 2aedb79

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

build.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ fn build() -> io::Result<()> {
307307
// run ./configure
308308
let output = configure
309309
.output()
310-
.expect(&format!("{:?} failed", configure));
310+
.unwrap_or_else(|_| panic!("{:?} failed", configure));
311311
if !output.status.success() {
312312
println!("configure: {}", String::from_utf8_lossy(&output.stdout));
313313

@@ -346,7 +346,7 @@ fn build() -> io::Result<()> {
346346

347347
fn check_features(
348348
include_paths: Vec<PathBuf>,
349-
infos: &Vec<(&'static str, Option<&'static str>, &'static str)>,
349+
infos: &[(&'static str, Option<&'static str>, &'static str)],
350350
) {
351351
let mut includes_code = String::new();
352352
let mut main_code = String::new();
@@ -527,11 +527,11 @@ fn check_features(
527527
}
528528
}
529529

530-
fn search_include(include_paths: &Vec<PathBuf>, header: &str) -> String {
530+
fn search_include(include_paths: &[PathBuf], header: &str) -> String {
531531
for dir in include_paths {
532532
let include = dir.join(header);
533533
if fs::metadata(&include).is_ok() {
534-
return format!("{}", include.as_path().to_str().unwrap());
534+
return include.as_path().to_str().unwrap().to_string();
535535
}
536536
}
537537
format!("/usr/include/{}", header)
@@ -560,9 +560,7 @@ fn main() {
560560
);
561561
link_to_libraries(statik);
562562
if fs::metadata(&search().join("lib").join("libavutil.a")).is_err() {
563-
fs::create_dir_all(&output())
564-
.ok()
565-
.expect("failed to create build directory");
563+
fs::create_dir_all(&output()).expect("failed to create build directory");
566564
fetch().unwrap();
567565
build().unwrap();
568566
}
@@ -658,7 +656,7 @@ fn main() {
658656

659657
check_features(
660658
include_paths.clone(),
661-
&vec![
659+
&[
662660
("libavutil/avutil.h", None, "FF_API_OLD_AVOPTIONS"),
663661
("libavutil/avutil.h", None, "FF_API_PIX_FMT"),
664662
("libavutil/avutil.h", None, "FF_API_CONTEXT_SIZE"),

src/avutil/rational.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use AVRational;
33

44
#[inline(always)]
55
pub unsafe fn av_make_q(num: c_int, den: c_int) -> AVRational {
6-
AVRational { num: num, den: den }
6+
AVRational { num, den }
77
}
88

99
#[inline(always)]

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#![allow(non_upper_case_globals)]
22
#![allow(non_camel_case_types)]
33
#![allow(non_snake_case)]
4+
#![allow(clippy::approx_constant)]
5+
#![allow(clippy::missing_safety_doc)]
6+
#![allow(clippy::redundant_static_lifetimes)]
7+
#![allow(clippy::too_many_arguments)]
8+
#![allow(clippy::type_complexity)]
49

510
extern crate libc;
611

0 commit comments

Comments
 (0)