From 25d9ac0333eab92136657ea72d5bbb211dae58ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 3 May 2023 13:39:19 +0300 Subject: [PATCH 1/2] Document MSRV in Cargo.toml While support for this was added in a much later cargo release, unknown keys are simply ignored in older versions. --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 335a0bd..3ccfae7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ A library to run the pkg-config system tool at build time in order to be used in Cargo build scripts. """ keywords = ["build-dependencies"] +rust-version = "1.30" [dev-dependencies] lazy_static = "1" From 902d5ca77077234b025a59ec5e8df061f722bd59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 3 May 2023 13:47:42 +0300 Subject: [PATCH 2/2] Fix a couple of clippy warnings --- src/lib.rs | 8 ++++---- tests/test.rs | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 89bb37a..3653032 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -446,7 +446,7 @@ impl Config { match (env::var("TARGET"), env::var("HOST")) { (Ok(target), Ok(host)) => { let kind = if host == target { "HOST" } else { "TARGET" }; - let target_u = target.replace("-", "_"); + let target_u = target.replace('-', "_"); self.env_var_os(&format!("{}_{}", var_base, target)) .or_else(|| self.env_var_os(&format!("{}_{}", var_base, target_u))) @@ -802,8 +802,8 @@ impl Library { } } - let mut linker_options = words.iter().filter(|arg| arg.starts_with("-Wl,")); - while let Some(option) = linker_options.next() { + let linker_options = words.iter().filter(|arg| arg.starts_with("-Wl,")); + for option in linker_options { let mut pop = false; let mut ld_option = vec![]; for subopt in option[4..].split(',') { @@ -829,7 +829,7 @@ impl Library { } fn parse_modversion(&mut self, output: &str) { - self.version.push_str(output.lines().nth(0).unwrap().trim()); + self.version.push_str(output.lines().next().unwrap().trim()); } } diff --git a/tests/test.rs b/tests/test.rs index 4e04ac0..0f37c72 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -24,10 +24,7 @@ fn reset() { } env::remove_var("TARGET"); env::remove_var("HOST"); - env::set_var( - "PKG_CONFIG_PATH", - &env::current_dir().unwrap().join("tests"), - ); + env::set_var("PKG_CONFIG_PATH", env::current_dir().unwrap().join("tests")); } fn find(name: &str) -> Result {