Skip to content

Commit

Permalink
chore: fix new clippy warnings
Browse files Browse the repository at this point in the history
- `clippy::needless_lifetimes` in request.rs
- `clippy::unnecessary-map-or` in vendored.rs
  • Loading branch information
bavshin-f5 committed Dec 27, 2024
1 parent 85570e2 commit 28d5f2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions nginx-sys/build/vendored.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ fn make_cache_dir() -> Result<PathBuf, Box<dyn StdError>> {
fn download(cache_dir: &Path, url: &str) -> Result<PathBuf, Box<dyn StdError>> {
fn proceed_with_download(file_path: &Path) -> bool {
// File does not exist or is zero bytes
!file_path.exists() || file_path.metadata().map_or(false, |m| m.len() < 1)
!file_path.exists() || file_path.metadata().is_ok_and(|m| m.len() < 1)
}
let filename = url.split('/').last().unwrap();
let file_path = cache_dir.join(filename);
Expand Down Expand Up @@ -544,7 +544,7 @@ fn compile_nginx(cache_dir: &Path) -> Result<(PathBuf, PathBuf), Box<dyn StdErro
let build_info_path = nginx_src_dir.join("last-build-info");
let current_build_info = build_info(&nginx_configure_flags);
let build_info_no_change = if build_info_path.exists() {
read_to_string(&build_info_path).map_or(false, |s| s == current_build_info)
read_to_string(&build_info_path).is_ok_and(|s| s == current_build_info)
} else {
false
};
Expand Down Expand Up @@ -599,7 +599,7 @@ fn nginx_configure_flags(
modules
};
let mut nginx_opts = vec![format_source_path("--prefix", nginx_install_dir)];
if env::var("NGX_DEBUG").map_or(false, |s| s == "true") {
if env::var("NGX_DEBUG").is_ok_and(|s| s == "true") {
println!("Enabling --with-debug");
nginx_opts.push("--with-debug".to_string());
}
Expand Down
4 changes: 2 additions & 2 deletions src/http/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ impl<'a> PartialEq<&'a Method> for Method {
}
}

impl<'a> PartialEq<Method> for &'a Method {
impl PartialEq<Method> for &Method {
#[inline]
fn eq(&self, other: &Method) -> bool {
*self == other
Expand Down Expand Up @@ -641,7 +641,7 @@ impl<'a> PartialEq<&'a str> for Method {
}
}

impl<'a> PartialEq<Method> for &'a str {
impl PartialEq<Method> for &str {
#[inline]
fn eq(&self, other: &Method) -> bool {
*self == other.as_ref()
Expand Down

0 comments on commit 28d5f2c

Please sign in to comment.