From f41dac26ebdd31693e62c20fdd0c5346f7e7a435 Mon Sep 17 00:00:00 2001 From: SkyfallWasTaken Date: Mon, 29 Jul 2024 18:47:52 +0100 Subject: [PATCH] Placate clippy --- crates/dinopkg-cli/src/command/init.rs | 6 ++---- crates/dinopkg-npm-registry/src/lib.rs | 7 ++----- crates/dinopkg-package-json/src/lib.rs | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/crates/dinopkg-cli/src/command/init.rs b/crates/dinopkg-cli/src/command/init.rs index 0d5a3bc..7bb884d 100644 --- a/crates/dinopkg-cli/src/command/init.rs +++ b/crates/dinopkg-cli/src/command/init.rs @@ -85,10 +85,8 @@ pub async fn init() -> Result<()> { let license: String = Input::with_theme(&ColorfulTheme::default()) .with_prompt("License") .validate_with(|input: &String| { - spdx::Expression::parse(input).map_or_else( - |err| Err(format!("license is invalid:\n{}", err.to_string())), - |_| Ok(()), - ) + spdx::Expression::parse(input) + .map_or_else(|err| Err(format!("license is invalid:\n{err}")), |_| Ok(())) }) .default("MIT".into()) .interact_text()?; diff --git a/crates/dinopkg-npm-registry/src/lib.rs b/crates/dinopkg-npm-registry/src/lib.rs index eba827a..618875e 100644 --- a/crates/dinopkg-npm-registry/src/lib.rs +++ b/crates/dinopkg-npm-registry/src/lib.rs @@ -23,13 +23,10 @@ pub enum Error { } impl PackageInfo { - pub async fn from_name( - package_name: &str, - client: &reqwest::Client, - ) -> Result { + pub async fn from_name(package_name: &str, client: &reqwest::Client) -> Result { let url = format!("{NPM_REGISTRY_ROOT_URL}/{package_name}"); let response = client.get(&url).send().await?; - let package_info = response.json::().await?; + let package_info = response.json::().await?; Ok(package_info) } } diff --git a/crates/dinopkg-package-json/src/lib.rs b/crates/dinopkg-package-json/src/lib.rs index 45e4ce4..c107945 100644 --- a/crates/dinopkg-package-json/src/lib.rs +++ b/crates/dinopkg-package-json/src/lib.rs @@ -43,7 +43,7 @@ fn is_false(value: &bool) -> bool { } #[inline(always)] -fn default_as_false() -> bool { +const fn default_as_false() -> bool { false }