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/zip_downloader.rs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'crates/shirabe/src/downloader/zip_downloader.rs') diff --git a/crates/shirabe/src/downloader/zip_downloader.rs b/crates/shirabe/src/downloader/zip_downloader.rs index 6f3c6e5..428ca2a 100644 --- a/crates/shirabe/src/downloader/zip_downloader.rs +++ b/crates/shirabe/src/downloader/zip_downloader.rs @@ -7,7 +7,6 @@ use crate::io::IOInterfaceImmutable; use crate::package::PackageInterfaceHandle; use crate::util::IniHelper; use crate::util::Platform; -use anyhow::Result; use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_external_packages::symfony::process::ExecutableFinder; @@ -63,7 +62,7 @@ impl ZipDownloader { package: PackageInterfaceHandle, file: &str, path: &str, - ) -> Result> { + ) -> anyhow::Result> { static WARNED_7ZIP_LINUX: Mutex = Mutex::new(false); let is_last_chance = !HAS_ZIP_ARCHIVE.lock().unwrap().unwrap_or(false); @@ -191,7 +190,7 @@ impl ZipDownloader { path: &str, package: PackageInterfaceHandle, executable: &str, - ) -> Result> { + ) -> anyhow::Result> { if is_last_chance { return Err(process_error); } @@ -277,10 +276,10 @@ impl ZipDownloader { package: PackageInterfaceHandle, file: &str, path: &str, - ) -> Result> { + ) -> anyhow::Result> { let mut zip_archive = self.zip_archive_object.take().unwrap_or_default(); - let result: Result> = (|| { + let result: anyhow::Result> = (|| { let retval = if !file_exists(file) || filesize(file).is_none_or(|s| s == 0) { Err(-1i64) } else { @@ -436,7 +435,7 @@ impl ArchiveDownloader for ZipDownloader { package: PackageInterfaceHandle, file: &str, path: &str, - ) -> Result> { + ) -> anyhow::Result> { self.extract_with_system_unzip(package, file, path).await } } @@ -446,7 +445,7 @@ impl ChangeReportInterface for ZipDownloader { &mut self, package: PackageInterfaceHandle, path: &str, - ) -> Result> { + ) -> anyhow::Result> { self.inner.get_local_changes(package, path) } } @@ -469,7 +468,7 @@ impl crate::downloader::DownloaderInterface for ZipDownloader { path: &str, prev_package: Option, output: bool, - ) -> Result> { + ) -> anyhow::Result> { { let mut unzip_commands = UNZIP_COMMANDS.lock().unwrap(); if unzip_commands.is_none() { @@ -608,7 +607,7 @@ impl crate::downloader::DownloaderInterface for ZipDownloader { package: PackageInterfaceHandle, path: &str, prev_package: Option, - ) -> Result> { + ) -> anyhow::Result> { ::prepare(self, r#type, package, path, prev_package).await } @@ -617,7 +616,7 @@ impl crate::downloader::DownloaderInterface for ZipDownloader { package: PackageInterfaceHandle, path: &str, output: bool, - ) -> Result> { + ) -> anyhow::Result> { ::install(self, package, path, output).await } @@ -626,7 +625,7 @@ impl crate::downloader::DownloaderInterface for ZipDownloader { initial: PackageInterfaceHandle, target: PackageInterfaceHandle, path: &str, - ) -> Result> { + ) -> anyhow::Result> { self.inner.update(initial, target, path).await } @@ -635,7 +634,7 @@ impl crate::downloader::DownloaderInterface for ZipDownloader { package: PackageInterfaceHandle, path: &str, output: bool, - ) -> Result> { + ) -> anyhow::Result> { self.inner.remove(package, path, output).await } @@ -645,7 +644,7 @@ impl crate::downloader::DownloaderInterface for ZipDownloader { package: PackageInterfaceHandle, path: &str, prev_package: Option, - ) -> Result> { + ) -> anyhow::Result> { ::cleanup(self, r#type, package, path, prev_package).await } } -- cgit v1.3.1