From 6dd3e50fc557b8df71ed4a614f4f7da83c5be31a Mon Sep 17 00:00:00 2001 From: Noritada Kobayashi Date: Sun, 1 Oct 2023 18:01:57 +0900 Subject: [PATCH] build: fix a clippy lint `clippy::ptr_arg` and make improvements --- build.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/build.rs b/build.rs index 8bbde44..52826c0 100644 --- a/build.rs +++ b/build.rs @@ -1,13 +1,10 @@ -use std::{ - env, fs, - path::{Path, PathBuf}, -}; +use std::{env, fs, path::Path}; fn main() -> Result<(), Box> { let out_dir = env::var_os("OUT_DIR").unwrap(); - if let Err(e) = check_nonemptiness(&PathBuf::from("def/CCT")) - .and(check_nonemptiness(&PathBuf::from("def/GRIB2"))) + if let Err(e) = + check_nonemptiness(Path::new("def/CCT")).and(check_nonemptiness(Path::new("def/GRIB2"))) { return Err(format!("{}; run `git submodule update --init`", e).into()); } @@ -48,7 +45,7 @@ fn main() -> Result<(), Box> { Ok(()) } -fn check_nonemptiness(dir: &PathBuf) -> Result<(), String> { +fn check_nonemptiness(dir: &Path) -> Result<(), String> { dir.read_dir() .map_err(|_| format!("{} is not a directory", dir.to_string_lossy())) .and_then(|mut iter| {