Fix some clippy lints.

This commit is contained in:
Emilio Cobos Álvarez
2021-06-19 10:59:39 +02:00
parent 63c1043dfb
commit 57add9c860
15 changed files with 38 additions and 40 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ fn get_contents_of_dir(path: &Path) -> Vec<String> {
path.read_dir()
.unwrap()
.map(|f| f.unwrap().file_name().to_str().unwrap().to_string())
.filter(|name| !name.starts_with("."))
.filter(|name| !name.starts_with('.'))
.collect()
}
+9 -12
View File
@@ -105,10 +105,8 @@ fn compile(
if let Ok(extra_flags) = env::var("CXXFLAGS") {
command.args(extra_flags.split_whitespace());
}
} else {
if let Ok(extra_flags) = env::var("CFLAGS") {
command.args(extra_flags.split_whitespace());
}
} else if let Ok(extra_flags) = env::var("CFLAGS") {
command.args(extra_flags.split_whitespace());
}
if let Some(style) = style {
@@ -142,8 +140,9 @@ fn compile(
}
}
const SKIP_WARNING_AS_ERROR_SUFFIX: &'static str = ".skip_warning_as_error";
const SKIP_WARNING_AS_ERROR_SUFFIX: &str = ".skip_warning_as_error";
#[allow(clippy::too_many_arguments)]
fn run_compile_test(
cbindgen_path: &'static str,
name: &'static str,
@@ -196,10 +195,8 @@ fn run_compile_test(
// We already generated an identical file previously.
if env::var_os("CBINDGEN_TEST_VERIFY").is_some() {
assert!(!generated_file.exists());
} else {
if generated_file.exists() {
fs::remove_file(&generated_file).unwrap();
}
} else if generated_file.exists() {
fs::remove_file(&generated_file).unwrap();
}
} else {
if env::var_os("CBINDGEN_TEST_VERIFY").is_some() {
@@ -248,7 +245,7 @@ fn test_file(cbindgen_path: &'static str, name: &'static str, filename: &'static
run_compile_test(
cbindgen_path,
name,
&test,
test,
tmp_dir,
Language::C,
*cpp_compat,
@@ -261,7 +258,7 @@ fn test_file(cbindgen_path: &'static str, name: &'static str, filename: &'static
run_compile_test(
cbindgen_path,
name,
&test,
test,
tmp_dir,
Language::Cxx,
/* cpp_compat = */ false,
@@ -275,7 +272,7 @@ fn test_file(cbindgen_path: &'static str, name: &'static str, filename: &'static
run_compile_test(
cbindgen_path,
name,
&test,
test,
tmp_dir,
Language::Cython,
/* cpp_compat = */ false,