From 9be0f98f71fe8071ab839ac1036b4064ac3172b4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 29 Jun 2026 00:03:00 +0900 Subject: chore(lint): ban bare `use anyhow::Result` and fully qualify it Add a no_banned_use linter that forbids importing anyhow::Result, and update all call sites to reference it via its fully-qualified path so it is never confused with std::result::Result. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/downloader/download_manager.rs | 49 +++++++++++------------ 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'crates/shirabe/src/downloader/download_manager.rs') diff --git a/crates/shirabe/src/downloader/download_manager.rs b/crates/shirabe/src/downloader/download_manager.rs index 82bf4bb..466570e 100644 --- a/crates/shirabe/src/downloader/download_manager.rs +++ b/crates/shirabe/src/downloader/download_manager.rs @@ -7,7 +7,6 @@ use crate::io::IOInterfaceImmutable; use crate::io::io_interface; use crate::package::PackageInterfaceHandle; use crate::util::Filesystem; -use anyhow::Result; use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::Preg; use shirabe_php_shim::{ @@ -97,7 +96,7 @@ impl DownloadManager { pub fn get_downloader( &self, r#type: &str, - ) -> Result>> { + ) -> anyhow::Result>> { let r#type = strtolower(r#type); if !self.downloaders.contains_key(&r#type) { return Err(InvalidArgumentException { @@ -123,7 +122,7 @@ impl DownloadManager { pub fn get_downloader_for_package( &self, package: PackageInterfaceHandle, - ) -> Result>>> { + ) -> anyhow::Result>>> { let installation_source = package.get_installation_source(); if "metapackage" == package.get_type() { @@ -190,7 +189,7 @@ impl DownloadManager { package: PackageInterfaceHandle, target_dir: &str, prev_package: Option, - ) -> Result> { + ) -> anyhow::Result> { let target_dir = self.normalize_target_dir(target_dir); self.filesystem .borrow_mut() @@ -278,7 +277,7 @@ impl DownloadManager { package: PackageInterfaceHandle, target_dir: &str, prev_package: Option, - ) -> Result> { + ) -> anyhow::Result> { let target_dir = self.normalize_target_dir(target_dir); if let Some(downloader) = self.get_downloader_for_package(package.clone())? { return downloader @@ -302,7 +301,7 @@ impl DownloadManager { &self, package: PackageInterfaceHandle, target_dir: &str, - ) -> Result> { + ) -> anyhow::Result> { let target_dir = self.normalize_target_dir(target_dir); if let Some(downloader) = self.get_downloader_for_package(package.clone())? { return downloader.borrow_mut().install2(package, &target_dir).await; @@ -324,7 +323,7 @@ impl DownloadManager { initial: PackageInterfaceHandle, target: PackageInterfaceHandle, target_dir: &str, - ) -> Result> { + ) -> anyhow::Result> { let target_dir = self.normalize_target_dir(target_dir); let downloader = self.get_downloader_for_package(target.clone())?; let initial_downloader = self.get_downloader_for_package(initial.clone())?; @@ -404,7 +403,7 @@ impl DownloadManager { &self, package: PackageInterfaceHandle, target_dir: &str, - ) -> Result> { + ) -> anyhow::Result> { let target_dir = self.normalize_target_dir(target_dir); if let Some(downloader) = self.get_downloader_for_package(package.clone())? { return downloader.borrow_mut().remove2(package, &target_dir).await; @@ -426,7 +425,7 @@ impl DownloadManager { package: PackageInterfaceHandle, target_dir: &str, prev_package: Option, - ) -> Result> { + ) -> anyhow::Result> { let target_dir = self.normalize_target_dir(target_dir); if let Some(downloader) = self.get_downloader_for_package(package.clone())? { return downloader @@ -472,7 +471,7 @@ impl DownloadManager { &self, package: PackageInterfaceHandle, prev_package: Option, - ) -> Result> { + ) -> anyhow::Result> { let source_type = package.get_source_type(); let dist_type = package.get_dist_type(); @@ -538,7 +537,7 @@ impl DownloadManager { &self, package: PackageInterfaceHandle, prev_package: Option, - ) -> Result> { + ) -> anyhow::Result> { self.get_available_sources(package, prev_package) } @@ -564,43 +563,43 @@ pub trait DownloadManagerInterface: std::fmt::Debug { fn get_downloader_for_package( &self, package: PackageInterfaceHandle, - ) -> Result>>>; + ) -> anyhow::Result>>>; async fn download( &self, package: PackageInterfaceHandle, target_dir: &str, prev_package: Option, - ) -> Result>; + ) -> anyhow::Result>; async fn prepare( &self, r#type: &str, package: PackageInterfaceHandle, target_dir: &str, prev_package: Option, - ) -> Result>; + ) -> anyhow::Result>; async fn install( &self, package: PackageInterfaceHandle, target_dir: &str, - ) -> Result>; + ) -> anyhow::Result>; async fn update( &self, initial: PackageInterfaceHandle, target: PackageInterfaceHandle, target_dir: &str, - ) -> Result>; + ) -> anyhow::Result>; async fn remove( &self, package: PackageInterfaceHandle, target_dir: &str, - ) -> Result>; + ) -> anyhow::Result>; async fn cleanup( &self, r#type: &str, package: PackageInterfaceHandle, target_dir: &str, prev_package: Option, - ) -> Result>; + ) -> anyhow::Result>; } #[async_trait::async_trait(?Send)] @@ -616,7 +615,7 @@ impl DownloadManagerInterface for DownloadManager { fn get_downloader_for_package( &self, package: PackageInterfaceHandle, - ) -> Result>>> { + ) -> anyhow::Result>>> { self.get_downloader_for_package(package) } @@ -625,7 +624,7 @@ impl DownloadManagerInterface for DownloadManager { package: PackageInterfaceHandle, target_dir: &str, prev_package: Option, - ) -> Result> { + ) -> anyhow::Result> { self.download(package, target_dir, prev_package).await } @@ -635,7 +634,7 @@ impl DownloadManagerInterface for DownloadManager { package: PackageInterfaceHandle, target_dir: &str, prev_package: Option, - ) -> Result> { + ) -> anyhow::Result> { self.prepare(r#type, package, target_dir, prev_package) .await } @@ -644,7 +643,7 @@ impl DownloadManagerInterface for DownloadManager { &self, package: PackageInterfaceHandle, target_dir: &str, - ) -> Result> { + ) -> anyhow::Result> { self.install(package, target_dir).await } @@ -653,7 +652,7 @@ impl DownloadManagerInterface for DownloadManager { initial: PackageInterfaceHandle, target: PackageInterfaceHandle, target_dir: &str, - ) -> Result> { + ) -> anyhow::Result> { self.update(initial, target, target_dir).await } @@ -661,7 +660,7 @@ impl DownloadManagerInterface for DownloadManager { &self, package: PackageInterfaceHandle, target_dir: &str, - ) -> Result> { + ) -> anyhow::Result> { self.remove(package, target_dir).await } @@ -671,7 +670,7 @@ impl DownloadManagerInterface for DownloadManager { package: PackageInterfaceHandle, target_dir: &str, prev_package: Option, - ) -> Result> { + ) -> anyhow::Result> { self.cleanup(r#type, package, target_dir, prev_package) .await } -- cgit v1.3.1