From c7a8f919e2ce96aa546f797ba5d313ea84a37d5a Mon Sep 17 00:00:00 2001 From: daimond113 Date: Sat, 8 Mar 2025 22:37:42 +0100 Subject: [PATCH] refactor: apply clippy lints --- src/cli/commands/cas/prune.rs | 2 +- src/cli/commands/self_install.rs | 4 ++-- src/cli/files.rs | 4 ++-- src/lib.rs | 1 - src/manifest/mod.rs | 2 +- src/manifest/overrides.rs | 2 +- src/names.rs | 4 ++-- src/source/fs.rs | 2 +- src/source/ids.rs | 2 +- 9 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/cli/commands/cas/prune.rs b/src/cli/commands/cas/prune.rs index 1e95a6c..f4254ad 100644 --- a/src/cli/commands/cas/prune.rs +++ b/src/cli/commands/cas/prune.rs @@ -40,7 +40,7 @@ async fn read_dir_stream( async fn get_nlinks(path: &Path) -> anyhow::Result { #[cfg(unix)] { - use std::os::unix::fs::MetadataExt; + use std::os::unix::fs::MetadataExt as _; let metadata = fs::metadata(path).await?; return Ok(metadata.nlink()); } diff --git a/src/cli/commands/self_install.rs b/src/cli/commands/self_install.rs index 2fe546d..20b8163 100644 --- a/src/cli/commands/self_install.rs +++ b/src/cli/commands/self_install.rs @@ -59,12 +59,12 @@ impl SelfInstallCommand { #[cfg(unix)] { println!( - r#"installed {} {}! add the following line to your shell profile in order to get the binary and binary exports as executables usable from anywhere: + r"installed {} {}! add the following line to your shell profile in order to get the binary and binary exports as executables usable from anywhere: {} and then restart your shell. -"#, +", CLI_STYLE.apply_to(env!("CARGO_BIN_NAME")), ADDED_STYLE.apply_to(env!("CARGO_PKG_VERSION")), style(format!(r#"export PATH="$PATH:$HOME/{HOME_DIR}/bin""#)).green(), diff --git a/src/cli/files.rs b/src/cli/files.rs index 31e8910..03ad378 100644 --- a/src/cli/files.rs +++ b/src/cli/files.rs @@ -3,9 +3,9 @@ use std::path::Path; pub async fn make_executable>(_path: P) -> anyhow::Result<()> { #[cfg(unix)] { - use anyhow::Context; + use anyhow::Context as _; use fs_err::tokio as fs; - use std::os::unix::fs::PermissionsExt; + use std::os::unix::fs::PermissionsExt as _; let mut perms = fs::metadata(&_path) .await diff --git a/src/lib.rs b/src/lib.rs index 2f4df21..8c8ae08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,4 @@ #![warn(missing_docs)] -#![deny(clippy::future_not_send)] //! A package manager for the Luau programming language, supporting multiple runtimes including Roblox and Lune. //! pesde has its own registry, however it can also use Wally, and Git repositories as package sources. //! It has been designed with multiple targets in mind, namely Roblox, Lune, and Luau. diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 2a55a8b..b6a6da5 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -197,7 +197,7 @@ impl schemars::JsonSchema for Alias { fn json_schema(_: &mut schemars::SchemaGenerator) -> schemars::Schema { schemars::json_schema!({ "type": "string", - "pattern": r#"^[a-zA-Z0-9_-]+$"#, + "pattern": r"^[a-zA-Z0-9_-]+$", }) } } diff --git a/src/manifest/overrides.rs b/src/manifest/overrides.rs index b0e32ba..234698b 100644 --- a/src/manifest/overrides.rs +++ b/src/manifest/overrides.rs @@ -41,7 +41,7 @@ impl schemars::JsonSchema for OverrideKey { fn json_schema(_: &mut schemars::SchemaGenerator) -> schemars::Schema { schemars::json_schema!({ "type": "string", - "pattern": r#"^(?:[a-zA-Z0-9_-]+>[a-zA-Z0-9_-]+(?:>[a-zA-Z0-9_-]+)*)(?:,(?:[a-zA-Z0-9_-]+>[a-zA-Z0-9_-]+(?:>[a-zA-Z0-9_-]+)*))*$"#, + "pattern": r"^(?:[a-zA-Z0-9_-]+>[a-zA-Z0-9_-]+(?:>[a-zA-Z0-9_-]+)*)(?:,(?:[a-zA-Z0-9_-]+>[a-zA-Z0-9_-]+(?:>[a-zA-Z0-9_-]+)*))*$", }) } } diff --git a/src/names.rs b/src/names.rs index 1b126b9..375722b 100644 --- a/src/names.rs +++ b/src/names.rs @@ -81,7 +81,7 @@ impl schemars::JsonSchema for PackageName { fn json_schema(_: &mut schemars::SchemaGenerator) -> schemars::Schema { schemars::json_schema!({ "type": "string", - "pattern": r#"^(?!_)(?![0-9]+\/)[a-z0-9_]{3,32}(? schemars::Schema { schemars::json_schema!({ "type": "string", - "pattern": r#"^(wally#)?[a-z0-9-]{1,64}\/[a-z0-9-]{1,64}$"# + "pattern": r"^(wally#)?[a-z0-9-]{1,64}\/[a-z0-9-]{1,64}$" }) } } diff --git a/src/source/fs.rs b/src/source/fs.rs index fb31304..f87db57 100644 --- a/src/source/fs.rs +++ b/src/source/fs.rs @@ -60,7 +60,7 @@ async fn set_readonly(path: &Path, readonly: bool) -> std::io::Result<()> { #[cfg(unix)] { - use std::os::unix::fs::PermissionsExt; + use std::os::unix::fs::PermissionsExt as _; permissions.set_mode(permissions.mode() | 0o644); } } diff --git a/src/source/ids.rs b/src/source/ids.rs index b7ef2dd..4945f96 100644 --- a/src/source/ids.rs +++ b/src/source/ids.rs @@ -89,7 +89,7 @@ impl schemars::JsonSchema for VersionId { schemars::json_schema!({ "type": "string", - "pattern": format!(r#"^({version_pattern}) ({target_pattern})$"#), + "pattern": format!(r"^({version_pattern}) ({target_pattern})$"), }) } }